Question: In Java Calorie intake data from a person is provided in a text file named food.txt. There are three numbers on each line, separated by

In Java

Calorie intake data from a person is provided in a text file named food.txt. There are three numbers on each line, separated by spaces. The numbers represent the number of calories consumed for breakfast, lunch and dinner. The file includes data for exactly one week starting from Monday. That is, the file contains seven lines of text. The topmost line is for Monday and the line at the bottom is for Sunday. Your program should read the data from the file into three separate arrays, one for breakfast, one for lunch, and one for dinner. Then, compute and print out the following information: 1. a list of total calories consumed each day 2. a list of days when more than 2250 calories are consumed 3. average calories consumed during each of the three meals. YOU MUST WRITE A METHOD WITH EXACTLY THREE ARRAY PARAMETERS TO COMPUTE EACH OF THE THREE LISTED ITEMS ABOVE AND DISPLAY THE RESULT. YOU SHOULD PRINT AN ERROR MESSAGE AND TERMINATE IF THERE ARE NOT EXACLTY THREE NUMBERS ON EACH LINE AND EXACTLY 7 LINES OVERALL.

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!