Please use java codding Problem: The last time you visited your aunt Mae, you he
ID: 3775876 • Letter: P
Question
Please use java codding
Problem: The last time you visited your aunt Mae, you help her find budget figures for some major expences for the last year. Then you stored the information in a comma separated text folr. the major expenses for each month will be on one line. the title file (input.txt) contain the following information:
-Month: string
-Food: double
-Mortgage: double
-Heating: double
-Car: double
Sample Data: January, 160, 600, 100, 60
Now Aunt Mae has asked for help in updating the budget. Since fuel cost have gone up, she estimates that the cost of heating will rise about 10% and the cost of running a car will increase about 5%. She will budget the same cost for food and her mortgage.
You have volonter to help her prepare a report containing the following information:( Use DecimalFormat class to show to decimal digit.)
1- read and display the contents of the file
2- Compute and display the Total cost for each month last year.
4-Compute and display the total cost for food last year.
4- compute and display the cost for each category after the increases.
5- Computer and display the average heating cost per month after the increases.
6- Compare and display the month that has the lowest cost after the increases.
Input.txt
Explanation / Answer
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.List; public class BufferedReaderExample { public static void main(String[] args) { try (BufferedReader br = new BufferedReader(new FileReader("Users.csv"))) { String sCurrentLine; String first = "Username is: "; String second = "Password is: "; java.util.HashMap data = new java.util.HashMap(); while ((sCurrentLine = br.readLine()) != null) { String[] information = sCurrentLine.split(","); String username = information[0]; String password = information[1]; System.out.println(username); System.out.println(password); data.put(username,password); } } catch (IOException e) { e.printStackTrace(); } } }Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.