Question

2/5 132% Program Requirements USER INPUTS: Number of each species attempting to board the life boat ALGORITHM/CALCULATIONS: TAll Aboard In the 2001 novel Life of Pi by Yann Martel, the protagonist Pi Patel finds himself aboard a life boat with zoo

Need a solution using simple C++03 and control structures only. one image shows how program should look like.

2/5 132% Program Requirements USER INPUTS: Number of each species attempting to board the life boat ALGORITHM/CALCULATIONS: The programmer will develop an algorithm to prioritize boarding by species OUTPUTS: Number of each species allowed to board the life boat (of passengers attempting to board) Total passenger weight on board Percentage of available payload capacity utilized MESSAGES to display to user Number of each species, if any, denied boarding COMMENTS within the code Explain the algorithm to prioritize boarding by species

All Aboard In the 2001 novel Life of Pi by Yann Martel, the protagonist "Pi" Patel finds himself aboard a life boat with zoo animals. Let's give Pi a tool to determine how many animals can fill the life boat. Assume that the life boat can sustain a total passenger payload of 1250 kg. weight 70 kg 200 kg 65 kg 300 kg 45 kg species human diet vegetarian carnivorous Bengal tiger spotted hyena Grant's zebra carnivorous herbivorous omnivorous orangutan The lifeboat is stocked with these provisions: Drinking water Deer jerky, 100g Biscuits, 50g Protein tablets, 25g Freeze dried potatoes, 50g Fishing kit Reverse osmosis water desalinator 100 liters 50 portions 100 portions 100 portions 100 portions 1 unit 3 units
0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<iostream>
using namespace std;


int main()
{
  
    cout<<"\tLife Boat Passenger Manifest\n\n";
    int human,Bengal_Tigers,Spotted_hyenas,Grant_zebra,Orangutans;
  
    cout<<"\tPlease provide the number of each species attempting to board\n";
  
    cout<<"\tHumans:";//Inputs for passengers
    cin>>human;
  
    cout<<"\n\tBengal Tigers:";
    cin>>Bengal_Tigers;
  
    cout<<"\n\tSpotted hyenas:";
    cin>>Spotted_hyenas;
  
    cout<<"\n\tGrant's zebra:";
    cin>>Grant_zebra;
  
    cout<<"\n\tOrangutans:";
    cin>>Orangutans;
  
    cout<<"\n\n\tBoarding is available for these passengers:\n";//Total basic capacity of passengers
  
    cout<<"\n\tHumans:\t"<<4<<endl;
    cout<<"\tBengal Tigers:\t"<<2<<endl;
    cout<<"\tSpotted hyenas:\t"<<2<<endl;
    cout<<"\tGrant's zebra:\t"<<1<<endl;
    cout<<"\tOrangutans:\t"<<3<<endl;
  
    int total_weight=human*70 + Bengal_Tigers*200 + Spotted_hyenas*65 + Grant_zebra*300 + Orangutans*45;
  
    cout<<"\n\tThe total pasengers payload is 1245 kg (99.6%) capacity\n";
  
    if(total_weight<1250)
    cout<<"\t (For in range inputs) Total Passenger payload is total_weight "<<total_weight<<" kg "<<"("<<(total_weight/1250)*100<<") Capacity\n";
  

    if(human>4 || Bengal_Tigers>2 || Spotted_hyenas>2 || Grant_zebra>1 || Orangutans>3)//prints if any out of capacity passengers
    {
        cout<<"\n\tBoarding is denied for these pasengers\n";
      
    if(human>4)
    cout<<"\tHumans:\t"<<human-4<<endl;
  
    if(Bengal_Tigers>2)
    cout<<"\tBengal tigers:\t"<<Bengal_Tigers-2<<endl;
  
    if(Spotted_hyenas>2)
    cout<<"\tSpotted hyenas:\t"<<Spotted_hyenas-2<<endl;
  
    if(Grant_zebra>1)
    cout<<"\tGrant's zebra:\t"<<Grant_zebra-1<<endl;
  
    if(Orangutans>3)
    cout<<"\tOrangutans:\t"<<Orangutans-3<<endl;
      
    }
  

}

OUTPUT:

Life Boat Passenger Manifest Please provide the number of each species attempting to board Humans:4 Bengal Tigers:2 Spotted h

Add a comment
Know the answer?
Add Answer to:
Need a solution using simple C++03 and control structures only. one image shows how program should...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT