Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Java program that receives the order of daily foods of the user and then suggests if the foods are healthy or not. There

Write a Java program that receives the order of daily foods of the user and then suggests if the foods are healthy or not. There are two tables for the amount of daily calories each gender require, and also a table that shows the calories of each food. The program receives the gender, age and activity level of the user, as well as the food order of a day, and then calculates if the food regime of the user is healthy.

image text in transcribedimage text in transcribed

For example, Susan (an active girl) has 1 cup of milk, 2 slices of bread, and 1 cup of yogurt for her breakfast, 3 slices of pizza for her lunch, and 2 potatoes for her dinner, as well as two cookies as snacks. Your program asks Susan about her age (e.g., 35), and then returns Healthy Food Regime or Unhealthy Food Regime as the output. The process for decision making if the food regime is healthy or not is as follows. First, the program calculates the total calories in a typical day of the user (through getting the food regime). Then, it compares this calculated number with the recommended calories per day given in the table. If the calculated calorie is +/- 200 calories within what recommended, the food is healthy. It is unhealthy otherwise. For instance, for Susan's case, if the total calorie consumed by her is within [2000, 2400], she has a healthy food regime. The user has at least three meals and one snack. Your program should ask these numbers from the user at the beginning.

So the program will ask the user there age, gender, food order and whether they are low active, moderately active or active. From there the program will calculate the number of calories and compare it to the table. So if you get a user that is a low active 42-year-old female any number of calories between 1600-2000 (+/-200 from 1800) would return a healthy food regimen. while anything outside of 1600-2000 will return an unhealthy food regimen.

Low active Age 1-10 1600 10-20 2600 | Active 2200 3000 3000 2800 2800 20-30 30-40 40-50 50-60 60-70 70 and up Male Moderately active 1800 2800 2600 2600 2400 2400 2200 2200 2400 2400 2200 2000 2000 2000 2600 2600 2400 Female Moderately active Low active 1400 2000 1800 2200 Active 2200 2400 1800 Age 1-10 10-20 20-30 30-40 40-50 50-60 60-70 70 and up 2000 2000 1800 1800 1600 1600 1600 2000 1800 1800 1800 2400 2200 2200 2200 2000 2000 Calorie 121 208 220 290 223 Food Low fat (2%) milk Chocolate milk (1 cup) | Yogurt (frozen, low fat) (1 cup) Pizza (cheese)(1 slice) Rice, white (1 cup) Pancake (4 inch diameter) | Cookie (oatmeal raisin)(1) Cereal, ready to eat (1 cup) Bread (white)(1 slice) Hamburger bun (1) Hot dog bun (1) Sweet Potato (1 large) 41 62 110 61 119 119 118 Low active Age 1-10 1600 10-20 2600 | Active 2200 3000 3000 2800 2800 20-30 30-40 40-50 50-60 60-70 70 and up Male Moderately active 1800 2800 2600 2600 2400 2400 2200 2200 2400 2400 2200 2000 2000 2000 2600 2600 2400 Female Moderately active Low active 1400 2000 1800 2200 Active 2200 2400 1800 Age 1-10 10-20 20-30 30-40 40-50 50-60 60-70 70 and up 2000 2000 1800 1800 1600 1600 1600 2000 1800 1800 1800 2400 2200 2200 2200 2000 2000 Calorie 121 208 220 290 223 Food Low fat (2%) milk Chocolate milk (1 cup) | Yogurt (frozen, low fat) (1 cup) Pizza (cheese)(1 slice) Rice, white (1 cup) Pancake (4 inch diameter) | Cookie (oatmeal raisin)(1) Cereal, ready to eat (1 cup) Bread (white)(1 slice) Hamburger bun (1) Hot dog bun (1) Sweet Potato (1 large) 41 62 110 61 119 119 118

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

Students also viewed these Databases questions