Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab #4d-Can Tarzan Save the Day? Er Well Maybe? Background Thirty cannibals begin to eat ten missionaries. It takes an hour to eat the first

image text in transcribed
Lab #4d-Can Tarzan Save the Day? Er Well Maybe? 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 in C++ 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: Missionaries Left 10 Cannibals Eating 30 29 End of Hour 80 73 Consider that a missionaty partially consumed is not a missionary saved. Extra, Extra Credit Challenge Change your program so that a single cannibal still eats at a rate of 1/30 of a missio nary per hour, BUT the ll prompt the user for the number of missionaries, the number of cannibals, and the distance Tarzan to travel. In other words your program should be general enough to handle any values for missionaries, needs cannibals (no more than 30) and Tarzan's distance

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions