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

Specifications: The information needed is: (1) the number of seahorses that will

ID: 3880389 • Letter: S

Question

Specifications:  The information needed is: (1) the number of seahorses that will be kept in the aquarium, and (2) whether or not seahorse milk will need to be added periodically for baby seahorses.The primary material needed to build the aquarium is glass. So your program has to compute the length, width, and depth for the aquarium as well as the thickness of the glass. To do that, your program should take into account the following information:

Each seahorse (regardless of its size) requires 20 gallons of water.

If there will be baby seahorses, a capacity of 1 gallon of water must be allocated for periodically adding seahorse milk (regardless of the number of baby seahorses).

Volume of water in gallons = length * width * depth * 7.47, where length, width, and depth are in feet.

Since seahorses are vertically oriented, the depth of the aquarium should be 1.5 times the length of the aquarium.

Width of the aquarium should be 1/4 of the length. This is for aesthetic purposes.

The thickness of the glass should be 10 mm for each 20 inches of depth of the aquarium (rounded down to the nearest mm).  

Your program should prompt the user (e.g., BoJack) to enter the necessary information. It should then do the appropriate calculations, and output the volume, dimensions, and glass thickness of the aquarium that Todd and Mr. Peanutbutter would need to build. For the computations, you might find that you need to raise a quantity to a power. In order to perform this mathematical operation, you need to use a special function called pow.   You don't know anything yet about functions, but in about 4 weeks we'll show you how to write them. For now, you can use functions in C++ that are already written and provided to you in a system library. In order to use pow, you will need to include the library that contains the code for that function. So, right after your  #include<iostream>, on the next line write #include <cmath>. Then, you can use pow and the compiler will recognize it. You need to know that pow will return a double precision float and takes two arguments, the first is the base and the second is the exponent. For example, if you want to compute x = y3, you would have this code:

                                                                        x = pow(y, 3);

Sample input and output are given below.


           Welcome to the Aquarium Calculator!

How many seahorses do you want in your aquarium?         10
Will there be baby seahorses that will need milk? (Y/N)         Y

           Specifications of your aquarium:

Volume:         201 gallons
Length:        4.155 ft
Width:            1.039 ft
Depth:         6.233 ft
Glass thickness:    37 mm

Explanation / Answer

Here is the code:

#include<iostream>
#include<math.h>
using namespace std;
int main()
{
   double n;char ch;
   cout<<" Welcome to aquarium calculator!! ";
   cout<<"How many sea horses do you want in your aquarium? ";
   cin>>n;
   cout<<"Will there be baby seahorses that will need milk? (Y/N) ";
   cin>>ch;
  
   double volume=20*n;
   if(ch=='Y')
   volume++;
  
   double l=cbrt(volume/2.80125);
   double w=.25*l;
   double d=1.5*l;
  
   double d1=d*12;
   double t=(d1/20)*10;
  
   cout<<"Volume: "<<volume<<"gallons ";
   cout<<"Length: "<<l<<"ft ";
   cout<<"Width: "<<w<<"ft ";
   cout<<"Depth: "<<d<<"ft ";
   cout<<"Glass Thickness: "<<(int)t<<" mm ";
  
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote