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 03:40
Mary's manager told her she should insert a graphic into her documentwrite mary a brief note describing how to insert a graphicin a word processing document.
Answers: 1
question
Computers and Technology, 22.06.2019 08:40
What are the three parts to physical security standards for various types of army equipment and the risk level
Answers: 2
question
Computers and Technology, 22.06.2019 18:00
Write a method named addall that could be placed inside the hashintset class. this method accepts another hashintset as a parameter and adds all elements from that set into the current set, if they are not already present. for example, if a set s1 contains [1, 2, 3] and another set s2 contains [1, 7, 3, 9], the call of s1.addall(s2); would change s1 to store [1, 2, 3, 7, 9] in some order. you are allowed to call methods on your set and/or the other set. do not modify the set passed in. this method should run in o(n) time where n is the number of elements in the parameter set passed in.
Answers: 2
question
Computers and Technology, 22.06.2019 22:30
Which of the following factors would your hypothetical supervisor look at when deciding whether to test a biological material sample for dna? the amount of other evidence you have implicating a suspect in a crime the annual budget for the crime lab both of the above none of the above; you would almost always order a test
Answers: 3
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
Physics, 24.10.2020 06:00
question
Mathematics, 24.10.2020 06:00
question
Mathematics, 24.10.2020 06:00
question
Mathematics, 24.10.2020 06:00
question
History, 24.10.2020 06:00
question
English, 24.10.2020 06:00
Questions on the website: 13722360