Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

write a program algorithm Monkey Business program: A local zoo wants to keep tra

ID: 3688476 • Letter: W

Question

write a program algorithm Monkey Business program: A local zoo wants to keep track of how many pounds of food each of its three monkeys eats each day during a typical week. Write a program that stores this information in a two-dimensional 3 × 5 array, where each row represents a different monkey and each column represents a different day of the week. The program should first have the user input the data for each monkey. Then it should create a report that includes the following information: • Average amount of food eaten per day by the whole family of monkeys. • The least amount of food eaten during the week by any one monkey. • The greatest amount of food eaten during the week by any one monkey. Input Validation: Do not accept negative numbers for pounds of food eaten.

Explanation / Answer

#include<iostream.h>
#include<conio.h>

void main()
{
   int a[3][5],i,j,s=0,sc=0;
   double av[3],max,min;
   for(i=0;i<3;i++)
   {
       cout<<"Enter data for monkey "<<i+1;
       for(j=0;j<5;j++)
       {
           cin>>a[j][i];
           s=s+a[j][i];

       }
       av[i]=s/5;
       s=0;
   }

   max=0;
   min=av[0];
   for(i=0;i<3;i++)
   {
       cout<<"Average amount of food eaten per day by monkey "<<i+1 <<"is "<<av[i]<<endl;
           if(av[i]>max)
               max=av[i];

           if(av[i]<min)
               min=av[i];

   }

   cout<<"Greatest amount of food eaten by any monkey is "<<max<<endl;

   cout<<"least amount of food eaten by any monkey is "<<min<<endl;

   getch();
}