Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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, respectively. 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 calories than required 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 listed items above and display the result You should print an error message and terminate if there are not exactly three numbers on each line, and exactly 7 lines overall.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Antipatterns Avoiding The Pitfalls Of Database Programming

Authors: Bill Karwin

1st Edition

1680508989, 978-1680508987

More Books

Students also viewed these Databases questions

Question

How do Dimensional Database Models differ from Relational Models?

Answered: 1 week ago

Question

What type of processing do Relational Databases support?

Answered: 1 week ago

Question

Describe several aggregation operators.

Answered: 1 week ago