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...
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.
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...
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...
1A) The manager of an assembly process wants to determine whether or not the number of...
1A) The manager of an assembly process wants to determine whether or not the number of defective articles manufactured depends on the day of the week the articles are produced. She collected the following information. Is there sufficient evidence to reject the hypothesis that the number of defective articles is independent of the day of the week on which they are produced? Use α = 0.05. Day of Week M Tu W Th F Nondefective 90 93 86 91 88...
The manager of an assembly process wants to determine whether or not the number of defective...
The manager of an assembly process wants to determine whether or not the number of defective articles manufactured depends on the day of the week the articles are produced. She collected the following information. Is there sufficient evidence to reject the hypothesis that the number of defective articles is independent of the day of the week on which they are produced? Use α = 0.01. Day of Week M Tu W Th F Nondefective 88 92 98 97 91 Defective...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT