# Calories

With Summer just around the corner, you’ve decided you want to get healthier. To help you with this goal, you decide to build a calorie tracker that will help you track your daily net caloric intake factoring in your calorie intake (number of calories you’ve eaten) and outtake (number of calories you’ve burned off from exercise) in one day.

Since you love walking, jogging, and running, you limit the types of exercise you will perform to one of these options:

For you, walking burns approximately 314 calories per hour

For you, jogging burns approximately 557 calories per hour

For you, running burns approximately 861 calories per hour

Create a modular program that will continuously prompt for the calorie count of each food item eaten today until the user indicates they are finished entering food item calorie counts. For example, if the user ate a slice of bread followed by a banana, they would enter 110 calories and then 105 calories. (Note: When running the program, you as the student will make up the number of calories for each food item eaten). The user must have eaten at least four food items and the program must enforce this.

Upon completion of entering all food item calorie counts for the day, the program should prompt the user to enter the type of exercise they performed for the day and the number of hours the exercise was performed. The type of exercise must be one of the options listed above, or no exercise at all, since the user might decide to take a break from exercise for the day. When exercise is performed in a given day, it is limited to only one type of exercise, performed once.

Finally, the program will print a well formatted report, detailing the total number of calories eaten, the total number of calories burned off, the net caloric intake (total number of calories eaten - total number of calories burned off), and feedback for the day based on the following rules for net caloric intake:

When the net caloric intake is less than 1200 calories, “That’s Dangerous! You need to eat more per day.” must appear

When the net caloric intake is between 1200 calories and 2000 calories, inclusive, “Good job! Keep up the good work.” must appear

When the net caloric intake is more than 2000 calories, “Oops, you went a little over. Try again tomorrow.” must appear

Other Requirements:

Your solution must contain one or more arrays or ArrayLists.

Your solution must demonstrate a modular design using modules.

You must validate all data input by the user. Whenever an invalid piece of data is entered, you must display an error message and re-prompt the user.

Programming Assignment 7: Solution Design

Create a defining diagram that shows the input, processing, and output

Create a structure diagram/hierarchy chart grouping processes from the defining diagram into modules (You need to do this, but you do not need to turn it in as part of the grade)

Create a modular solution algorithm using pseudocode

Show testing using the desk checking table method, to include test data, expected results, and a desk checking table. Make sure your desk checking considers multiple cases including both valid and invalid test data to prove your algorithm will work

Upload a Word document containing only items above to Blackboard.

Full points will be awarded for an accurate, efficient, complete defining diagram, solution algorithm, and desk checking table. Partial credit is available.

Programming Assignment 8: Solution Implementation

Write a well-documented, efficient Java program that implements the algorithm you identified. Include appropriate documentation as identified in the documentation expectations document.

Note: You may not use the Scanner or System classes for input/output. You must use the JOptionPane class. Additionally, you may not use System.exit, or any variant that exits the program in the middle of the program. The program should only exit once the algorithm has finished completing.

Upload the .java file of the final program to Blackboard. Be careful that you do not submit a .class file instead of a .java file.

Full points will be awarded for an accurate, efficient, complete Java program that compiles using jGrasp. Partial credit is available. Any final program that does not compile, for any reason, will receive an automatic zero. Other IDEs often place in additional code that you are unaware of, doing too much of the work for you. You are strongly discouraged from using IDEs other than jGrasp.