Question

In: Computer Science

The manager of Fish Haven wants a program that displays the number of gallons of water...

The manager of Fish Haven wants a program that displays the number of gallons of water a rectangular aquarium holds, given the aquarium’s length, width, and height measurements in inches. (Hint: There are 231 cubic inches in a gallon.)a.Using the chart shown earlier in Figure 4-12 as a guide, enter the input, processing, and output items, as well as the algorithm, in the first column. b.Desk-check the algorithm twice. For the first desk-check, use 20.5, 10.5, and 12.5 as the length, width, and height measurements. For the second desk-check, use 30, 9, and 14. c.Enter the C++ instructions in the second column of the chart, and then desk-check the program using the same data used to desk-check the algorithm.d.If necessary, create a new project named Introductory12 Project, and save it in the Cpp8\Chap04 folder. Enter your C++ instructions into a source file named Introductory12.cpp. Also enter appropriate comments and any additional instructions required by the compiler. Test the program using the same data used to desk-check the program.

Solutions

Expert Solution

C++ CODE: ( Introductory12.cpp )

#include<iostream>
#include<iomanip>

using namespace std;

int main()
{
   // variable to store the length, width, height
   double length;
   double width;
   double height;
  
   //variable to store the volume, gallons
   double volume;
   double gallons;
  
   // getting the length from the user
   cout<<"Enter the length: ";
   cin>>length;
  
  
   // getting the width from the user
   cout<<"Enter the width: ";
   cin>>width;
  
   // getting the height from the user
   cout<<"Enter the height: ";
   cin>>height;

   // calculating the volume
   volume= length * width * height;
  
   // calculating the gallons
   gallons = volume/231;
  
   //displaying the gallons
   cout<<"\nNumber of gallons of water in aquarium: "<<setprecision(2)<<fixed<<gallons;
  
  
   return 0;  
}

ALGORITHM:

1. start
2. input length, width, height
3. calculate volume = length * width * height
4. calculate gallons = volume /231
5. print "Number of gallons in aquarium =", gallons
5. end

SCREENSHOT FOR OUTPUT:


Related Solutions

3. The general manager of Gordon's Self-Service Gasoline wants to estimate the mean number of gallons...
3. The general manager of Gordon's Self-Service Gasoline wants to estimate the mean number of gallons of gasoline that are purchased by customers at his Kansas City locations. He would like the estimate to be within plus or minus 0.50 gallons. Based on past studies, the standard deviation of the amount purchased is 4.0 gallons. a. How large must the sample be for him to be 99% confident about that estimate? b. How large must the sample be for him...
In this exercise, you create a program for the sales manager at Computer Haven, a small...
In this exercise, you create a program for the sales manager at Computer Haven, a small business that offers motivational seminars to local companies. Figure 7-53 shows the charge for attending a seminar. Notice that the charge per person depends on the number of people the company registers. For example, the cost for four registrants is $400; the cost for two registrants is $300. The program should allow the sales manager to enter the number of registrants for as many...
C++ Create a program that checks whether a number is a prime number and displays its...
C++ Create a program that checks whether a number is a prime number and displays its factors if it is not a prime number. Console Prime Number Checker Please enter an integer between 1 and 5000: 5 5 is a prime number. Try again? (y/n): y Please enter an integer between 1 and 5000: 6 6 is NOT a prime number. It has 4 factors: 1 2 3 6 Try again? (y/n): y Please enter an integer between 1 and...
Ten different families are tested for the number of gallons of water a day they use...
Ten different families are tested for the number of gallons of water a day they use before and after viewing a conservation video. At the 0.05 significance level, test the claim that the mean is the same before and after the viewing. List the null and alternative hypothesis, the critical value, the test statistic with and sd. Draw the graph and label the test statistic, critical value and rejection regions. Reject or fail to reject? State the conclusion Before 33...
1.Write a Java program that inputs a binary number and displays the same number in decimal....
1.Write a Java program that inputs a binary number and displays the same number in decimal. 2.Write Java program that inputs a decimal number and displays the same number in binary.
Write a program named MakeChange that calculates and displays the conversion of an entered number of...
Write a program named MakeChange that calculates and displays the conversion of an entered number of dollars into currency denominations—twenties, tens, fives, and ones. For example, if 113 dollars is entered, the output would be twenties: 5 tens: 1 fives: 0 ones: 3. Answer in C# (P.S i'm posting the incomplete code that i have so far below.) using System; using static System.Console; class MakeChange { static void Main() { int twenties, tens, fives, ones; WriteLine("Enter the number of dollars:");...
in java Write a program that reads in ten numbers and displays the number of distinct...
in java Write a program that reads in ten numbers and displays the number of distinct numbers and the distinct numbers separated by exactly one space (i.e., if a number appears multiple times, it is displayed only once). (Hint: Read a number and store it to an array if it is new. If the number is already in the array, ignore it.) After the input, the array contains the distinct numbers. Here is the sample run of the program: Enter...
Eight different families are tested for the number gallons of water a day they use before...
Eight different families are tested for the number gallons of water a day they use before and after viewing a conservation video. Information is given below. Do you believe that the conservation video is helpful to save daily water usage? Explain your answer using both confidence interval method and hypothesis test method. before 34 33 38 33 40 31 33 35 after 33 28 25 35 31 28 35 28
write a program that computes and displays the number of days that have elapsed between January...
write a program that computes and displays the number of days that have elapsed between January 1, 1900 and today (the day the program is run). The program must be designed as follows: Within a class named Elapsed_Days, provide the following functions: • bool is_year_valid(long year) returns true if year is >= 1900; otherwise false • bool is_month_valid(long month) returns true if month is between 1 and 12 (inclusive); otherwise false • bool is_leap_year(long year) returns true if year is...
initially a large tank with a capacity of 300 gallons contains 150 gallons of clean water....
initially a large tank with a capacity of 300 gallons contains 150 gallons of clean water. A solution of salt with a concentration of 2 lb / gal flows into the tank at a rate of 50 gal / min. The solution is perfectly well mixed while the solution is extracted at a rate of 25 gal / min. Find: a) the amount of salt in the tank at the time it is filled (in pounds) b) the speed at...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT