Writing the complete program

I started this program and i am completely lost with it. If anyone can help me it would be very appreciated. This is the information i have:



Background:
Thirty cannibals begin to eat ten missionaries. It takes an hour to eat the first missionary. After each
missionary is eaten, one cannibal steals away into the forest. Each cannibal eats at a constant rate.
Therefore, since there are fewer consumers (cannibals), fewer missionaries will be consumed in each hour.
Fortunately for the missionaries help is on the way. Tarzan is coming!!! However, he is 80 miles away. During
the day Tarzan travels at seven miles per hour. During the darkness Tarzan reduces his speed (gotta watch
out for those trees) to 4 miles per hour. Darkness lasts nine hours. When the cannibals start eating, there are
only 3 hours of light left.
Problem:
Write a program to calculate and display how many cannibals will be caught and how many missionaries will
be saved. Display your results in the following form:
End of Hour Missionaries Left Cannibals Eating Tarzan Distance
0 10 30 80
1 9 29 73
:
:
Consider that a missionary partially consumed is not a missionary saved.
Part 2:
Change your program so that a single cannibal still eats at a rate of 1/30 of a missionary per hour, BUT the
program will prompt the user for the number of missionaries, the number of cannibals, and the distance Tarzan
needs to travel. In other words your program should be general enough to handle any values for missionaries,
cannibals and Tarzan’s distance.


We have just finished learning Do...While, While, and For loops if that helps at all. Thank you.
Last edited on
I started this program and i am completely lost with it.


What program? I dont see a program anywhere. Please provide us with what you've done so far, and put all of your code between code tags <>, under the format section.
I would get a pencil and paper and do the math first. Then take a look at the logical progression of the calculations and code accordingly.
Because I found the problem description amusing, I'm going to suggest that instead of keep track of missionaries, you keep track of health.

At the start of the program, int health = numMissionaries * 30;.

For every hour, health -= numCannibals;.

And at the end of the program, numMissionaries = health / 30;.
Topic archived. No new replies allowed.