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>