1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
svetoff [14.1K]
2 years ago
14

Because filling a pool/pond with water requires much more water than normal usage, your local city charges a special rate of $0.

77 per cubic foot of water to fill a pool/pond. In addition, it charges a one-time fee of $100.00 for filling. This water department has requested you, as a programmer, write a C program that allows the user to enter a pool's length, width, and depth, in feet measurement. The program will then calculate the pool's volume, the volume of water needed to fill the pool with the water level 3 inches below the top, and the final cost of filling the pool, including the one-time fee. And then, all the entered sizes of the pool (in feet) and the three calculated values will be displayed on the screen. Finally, your full name as the programmer who wrote the program must be displayed at the end. To find the volume of the pool in cubic feet, use the formula: volume
Computers and Technology
1 answer:
nevsk [136]2 years ago
3 0

Answer:

In C:

#include <stdio.h>

int main(){

   float length, width, depth,poolvolume,watervolume,charges;

   printf("Length (feet) : ");    scanf("%f",&length);

   printf("Width (feet) : ");    scanf("%f",&width);

   printf("Depth (feet) : ");    scanf("%f",&depth);

   poolvolume = length * width* depth;

   watervolume = length * width* (12 * depth - 3)/12;

   charges = 100 + 0.77 * watervolume;

   printf("Invoice");

   printf("\nVolume of the pool: %.2f",poolvolume);

   printf("\nAmount of the water needed: %.2f",watervolume);

   printf("\nCost: $%.2f",charges);

   printf("\nLength: %.2f",length);

   printf("\nWidth: %.2f",width);

   printf("\nDepth: %.2f",depth);

   printf("\nMr. Royal [Replace with your name] ");

   return 0;}

Explanation:

This declares the pool dimensions, the pool volume, the water volume and the charges as float    

float length, width, depth,poolvolume,watervolume,charges;

This gets input for length

   printf("Length (feet) : ");    scanf("%f",&length);

This gets input for width

   printf("Width (feet) : ");    scanf("%f",&width);

This gets input for depth

   printf("Depth (feet) : ");    scanf("%f",&depth);

This calculates the pool volume

   poolvolume = length * width* depth;

This calculates the amount of water needed

   watervolume = length * width* (12 * depth - 3)/12;

This calculates the charges

   charges = 100 + 0.77 * watervolume;

This prints the heading Invoice

printf("Invoice");

This prints the volume of the pool

   printf("\nVolume of the pool: %.2f",poolvolume);

This prints the amount of water needed

   printf("\nAmount of the water needed: %.2f",watervolume);

This prints the total charges

   printf("\nCost: $%.2f",charges);

This prints the inputted length

   printf("\nLength: %.2f",length);

This prints the inputted width

   printf("\nWidth: %.2f",width);

This prints the inputted depth

   printf("\nDepth: %.2f",depth);

This prints the name of the programmer

   printf("\nMr. Royal [Replace with your name] ");

   return 0;}

<em>See attachment for program in text file</em>

Download txt
You might be interested in
Give an O(log m + log n)-time algorithm that takes two sorted lists of sizes m and n, respectively, as input and returns the ith
olga2289 [7]

Binary search is used similarly. K'th element is found in more productive way.

<u>Explanation:</u>

arr1 and arr2 are the middle elements which are compared, let us compute as mid1 and mid2. Let us predict arr1 [mid1] k, the elements are not needed after mid2 elements.  arr2 are set as last element for arr2 [mid2].  New sub problems are defined. When one array is half the size.

C++ code for the algorithm.

#include <iostream>

using namespace std;    

int kth(int *arr1, int *arr2, int *end1, int *end2, int k)

{

if (arr1 == end1)

return arr2[k];

if (arr2 == end2)

return arr1[k];

int mid1 = (end1 - arr1) / 2;

int mid2 = (end2 - arr2) / 2;

if (mid1 + mid2 < k)

{

if (arr1[mid1] > arr2[mid2])

return kth(arr1, arr2 + mid2 + 1, end1, end2,

k - mid2 - 1);

else

return kth(arr1 + mid1 + 1, arr2, end1, end2,

k - mid1 - 1);

}

else

{

if (arr1[mid1] > arr2[mid2])

return kth(arr1, arr2, arr1 + mid1, end2, k);

else

return kth(arr1, arr2, end1, arr2 + mid2, k);

}    

int main()

{

int arr1[5] = {2, 3, 6, 7, 9};

int arr2[4] = {1, 4, 8, 10};    

int k = 5;

cout << kth(arr1, arr2, arr1 + 5, arr2 + 4, k - 1);

return 0;

}

7 0
3 years ago
A technician removes the cap from the brake fluid reservoir and finds that the rubber boot in the cap is swollen. technician a s
uysha [10]

Technician A is correct, there could be water or other contaminant in the brake fluid reservoir. The swollen cap needs to be replaced, some sell only the rubber part of the cap which could help save you money.

5 0
2 years ago
What are the conditions for using still photos in a video program
ozzi
It is the basic way to Photoshop in a video
4 0
3 years ago
Which of the following events would most likely produce an earthquake
sveticcg [70]

Earthquakes are usually caused when rock underground suddenly breaks along a fault. This sudden release of energy causes the seismic waves that make the ground shake. When two blocks of rock or two plates are rubbing against each other, they stick a little. ... When the rocks break, the earthquake occurs.

8 0
3 years ago
How do i do a mutioutput on a mac
Tcecarenko [31]
Here's what I found

To use an aggregate device with Logic:
Open Logic Pro or Logic Express.
Choose Logic Pro > Preferences > Audio or Logic Express > Preferences > Audio and select the Devices tab.
Select the Output Device drop-down menu and choose the aggregate device from the list. ...
Click Apply Changes at the bottom-right of the window.
4 0
3 years ago
Other questions:
  • Write a function decimalToBinaryRecursive that converts a decimal value to binary using recursion. This function takes a single
    11·1 answer
  • Which of the following statements about Linux is not​ true? A. Linux works on all the major hardware platforms. B. It plays a ma
    5·1 answer
  • Any parameter that receives a value and also sends a value outside the function must be declared as a reference parameter.
    8·1 answer
  • ____ devices are high-performance storage systems that are connected individually to a network to provide storage for the comput
    5·1 answer
  • A hacker uses a valid IP address of an internal host, and then from an external system, the hacker attempts to establish a commu
    11·1 answer
  • Fill in the blanks:
    15·1 answer
  • The East Coast sales division of a company generates 62 percent of total sales. Based on that percentage, write a Python program
    7·1 answer
  • Xxx<br>uuuuuu<br>uuuu<br>jjnmn<br>jjh
    12·1 answer
  • 15. Virus cannot infect files that are saved in i. USB ii. CD-ROMs iii. Memory card iv. All of them​
    14·2 answers
  • Who is the best Attack on Titan Character?
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!