Question: Read from File/write to output file Can only use For, While, Do-While loops. no Try statements or Catches. Current code trying to work with CISS

Read from File/write to output file

Read from File/write to output file Can only use For, While, Do-Whileloops. no Try statements or Catches. Current code trying to work with

CISS 110 Programming & Logic I Fall 2017 Project 1 Due Date:

Can only use For, While, Do-While loops. no Try statements or Catches.

Current code trying to work with

Sunday, November 12, 2017 Write a program called Budget. Name your fileBudget.java This program will use nested loops to calculate whether an individual

CISS 110 Programming & Logic I Fall 2017 Project 1 Due Date: Sunday, November 12, 2017 Write a program called Budget. Name your file Budget.java This program will use nested loops to calculate whether an individual is over or under their budget each month. It will read data from an input file and write the results to an output file The outer loop will run as as long as there is more data in the file. This outer loop should be a while loop and use the Scanner method hasNext () to determine whether it should continue. Within the outer loop, acquire the month and the total budgeted for the month. The month will be the first line of each data set contained in the input file and it should be read and stored in a String variable The amount budgeted for the month will be the second line of each data set and it should be read and stored in a double variable Then, an inner loop will iterate six times, one per budget category. The six categories are: food, rent, utilities, clothing, entertainment, personal care. The file will contain the amount spent for each category, one amount per line. The program will keep track of the total amount spent. This running total will be stored in an accumulator variable. This variable will have to be initialized to zero outside the inner loop but inside the outer loop. The inner loop will be a for loop that will iterate six times, from 0 to 5. When the for loop has completed execution, the accumulator variable will contain the total expenses. After the inner loop completes, write the specified output to the output file: the month, the amount budgeted and the total amount spent (accumulated in the for loop) for the month. Then, calculate whether the user went over or under the budget for that month and write this data to the file The input file, the file you will read from, is called budgetInput.txt. Hard code the name of this input file in your program. The File and Scanner classes can be used to read from the file. You can assume this file exists. A sample file has been provided to you, but it will not be the file used to grade your project

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!