Question: Your RunBudget.java program currently collects and summarizes data. It utilizes a loop to acquire monthly budget information from a file and writes the summarized output
Your RunBudget.java program currently collects and summarizes data. It utilizes a loop to acquire monthly budget information from a file and writes the summarized output to a separate file. The program acquires the month, that months total budget, and expenses for six categories from the input file and the program prints a summary to an output file. This process is repeated for each month in the input file.
The program creates a Budget object created from a Budget class that contains fields for the budget month, total value budgeted, and expenses for six categories. The Budget class defines a no-argument constructor method, setter and getter methods for each field, and a method that returns the sum of the six categories of expenses.
The input file contains zero or more sets of data that are comprised of a month, a total budget value, and six values corresponding to the expenses for the month.
In Budget.java, you will add a constructor method, a toString() method, and a method that returns a summary of the Budget object.
In RunBudget.java, you will create an array of type Budget. As the budget information is read from the file, a budget object will be created. Each Budget object will be added to the array. A loop will iterate through the Budget array and write to the output file.
Budget.java
RunBudget.java
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
