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

Respuesta :

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;}

See attachment for program in text file

Ver imagen MrRoyal