This exercise requires designing a Java software program which solves the problem described in the problem statement below. Please provide comments as necessary.

Your solution (identification headers) must include the following:

1.Flowchart
2.Pseudo-code
3.Program coded
4.Program output

Problem Statement

Design a program that asks for the number of fat grams and calories in a food item to determine the percentage of calories from fat. Validate input as follows:

  • The number of fat grams must be at least 0.
  • The number of calories must be at least 0.
  • The number of calories cannot be less than fat grams * 9.

After input has been validated, use the following formula to determine the percentage of calories from fat:

Percentage of calories from fat = (fat grams * 9) / calories.

Your program should consist of the following:

Module main. Calls getFat, getCalories, and showPercent.

Function getFat. Accepts user input of fat grams. Validate user input as a non-negative number and return valid fat grams.

Function getCalories. Accepts user input of total calories. Validate user input as a number that is non-negative and greater than or equal to (fat grams * 9). Return a valid number of calories.

Module showPercent. Displays percent of fat in the food item, determined by this formula: (fat grams * 9) / calories. Displays a message indicating the food item is "low fat" if the percentage of fat is less than 30% (0.3).

Expected Output

Your output should be similar to the following:

Please enter the number of fat grams: 20
Please enter the number of calories: 100
The number of calories cannot be less than the number of fat grams * 9.
Please enter the number of calories. 200
The percentage of calories from fat is 80.0 percent.
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.