Question: ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((C++ prog )))))))))))))))))))))))))))) ))))))))))))))))))))))))))))))))))))))) Exercise #4 The Cat's Calories Write a program to simulate the energy of a cat. The cat starts with C calories
((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((C++ prog ))))))))))))))))))))))))))))
)))))))))))))))))))))))))))))))))))))))
Exercise \#4 The Cat's Calories Write a program to simulate the energy of a cat. The cat starts with C calories of energy. When it walks for one hour, it burns B calories. After walking, the cat has to eat for one hour, and will gain E calories. After eating, it goes back to walking. And, so on, as long as it has energy. Your program should prompt the user to enter values for C,B, and E. Then the program produces the hour-by-hour progress for the cat, and finally prints the total number of hours needed for the cat's energy to reach zero. The cat stops walking or eating when the energy is zero or less. Sample inputs / outputs: Welcome to the cat energy simulation. Enter values for C, B, and E separated by spaces: 942 The following is your cat's hour-by-hour progress: Hour 1 - Walking - Remaining Energy (94=5) Hour 2 - Eating - Remaining Energy (5+2=7) Hour 3 - Walking - Remaining Energy (74=3) Hour 4 - Eating - Remaining Energy (3+2=5) Hour 5 - Walking - Remaining Energy (54=1) Hour 6 - Eating - Remaining Energy (1+2=3) Hour 7 - Walking - Remaining Energy (34=1) The cat will stop after 7 hours
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
