subject

G Write a complete C++ program that has the user enter the number of calories and the fat grams in a food. The program should calculate and display the percentage of calories that come from fat: One gram of fat has 9 calories Calories from fat = fat grams * 9 Percentage of calories from fat = calories from fat / total calories If the calories from fat are less than 30% of the total calories of the food, it should also display a message indicating the food is low in fat. Input validation—Number of calories and fat grams cannot be less than zero. Also, the number of calories from fat cannot be greater than the total number of calories. Display appropriate error messages. You do not need to check for cin failure. Sample test data: Calories Fat Output 100 3 grams 27 % fat, low in fat 200 12 grams 54% fat 50 0 0 % fat 90 -5 Error in input 45 8 Error in input

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 06:30
This technology is used to produce high-quality documents that look good on the computer screen and in print.
Answers: 1
question
Computers and Technology, 22.06.2019 21:30
Elements such as fonts colors visual structure graphics and the interface of a web page should complement each other to ensure blank
Answers: 3
question
Computers and Technology, 23.06.2019 16:10
What is the ooh? a. omaha occupation handbook b. online occupational c. occupations online d. occupational outlook handbook select the best answer from the choices provided
Answers: 3
question
Computers and Technology, 23.06.2019 18:30
This program should be a short piece of code that prints all of the positive integers from 1 to 100 as described more fully below. the program may contain multiple methods, and if using an oo language, should be contained within a single class or object. the program should be designed so that it begins execution when invoked through whichever mechanism is most common for the implementation language. â–ş print out all positive integers from 1 to 100, inclusive and in order. â–ş print messages to standard output, matching the sample output below. â–ş in the output, state whether the each integer is 'odd' or 'even' in the output. â–ş if the number is divisible by three, instead of stating that the number is odd or even, state that the number is 'divisible by three'. â–ş if the number is divisible by both two and three, instead of saying that the number is odd, even or divisible by three; state that the number is 'divisible by two and three'. â–ş design the logic of the loop to be as efficient as possible, using the minimal number of operations to perform the required logic. sample output the number '1' is odd. the number '2' is even. the number '3' is divisible by three. the number '6' is divisible by two and three.
Answers: 1
You know the right answer?
G Write a complete C++ program that has the user enter the number of calories and the fat grams in a...
Questions
question
English, 03.12.2020 18:10
question
Biology, 03.12.2020 18:10
Questions on the website: 13722367