Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

USING JAVA AND USE SCANNER TO READ FROM THE FILE. Calorie intake data from a person is provided in a text file named food.txt. There

USING JAVA AND USE SCANNER TO READ FROM THE FILE. Calorie intake data from a person is provided in a text file named food.txt. There are arbitrary number of double values on each line, separated by spaces. The numbers represent the number of calories consumed for meals and/or snacks on a day. 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 a 2- dimensional array. The number of rows of the 2-dimensional array must be equal to the number of valid lines in the file. The numbers in the i-th row of the 2-dimensional array must appear in the same sequence of numbers in the i-th row of the file. After reading the input file into the 2-dimensional array, report the following items. NEED A METHOD FOR EACH OF THESE THREE ITEMS 1. LIST OF TOTAL CALORIES CONSUMED EACH DAY 2. LIST OF DAYS WHEN MORE THAN 2250 CALORIES WERE CONSUMED 3. AVERAGE CALORIES CONSUMED DURING THE I-TH MEAL/SNACK(AVERAGE OVER ALL SEVEN DAYS) You should print an error message and terminate if there are not exactly 7 lines.

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

Step: 3

blur-text-image

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

Inductive Databases And Constraint Based Data Mining

Authors: Saso Dzeroski ,Bart Goethals ,Pance Panov

2010th Edition

1489982175, 978-1489982179

More Books

Students also viewed these Databases questions

Question

1. Does the survey prompt discussions with your direct reports?

Answered: 1 week ago