Answer:
// code in C#.
using System;
class WallPaint {
static void Main()
{
//variables
double l,w,h;
double win_area,door_area;
double amount_gallon;
Console.WriteLine("enter length of room:");
// read the length of room
l= Convert.ToDouble(Console.ReadLine());
Console.WriteLine("enter width of room:");
// read the width of room
w= Convert.ToDouble(Console.ReadLine());
Console.WriteLine("enter height of room:");
// read the height of room
h= Convert.ToDouble(Console.ReadLine());
Console.WriteLine("enter amount of a gallon:");
// read the amount of a gallon
amount_gallon= Convert.ToDouble(Console.ReadLine());
// find the area of both window
win_area=2*(2*3);
// area of door
door_area=8*5;
// total area of all walls
double tot_room_area=2*(l*h)+2*(w*h);
// area to be painted
double paint_area=tot_room_area-(win_area+door_area);
// gallos of paint required
double no_gallon=paint_area/120;
// total amount of paint
double tot_amount=no_gallon*amount_gallon;
// print the area to be painted
Console.WriteLine("total square footage of walls to be painted : "+paint_area);
// print amount of paint
Console.WriteLine("total amount of paint is: "+tot_amount);
}
}
Step-by-step explanation:
Read the length, width and height of the room from user.Read the amount of paint per gallon from user.Calculate the total area of all the walls.Calculate the area or window and door.Then find the area to be painted by subtracting window and door area from total wall area.Then find the number of gallon of paint required to paint all the area.Then calculate the total amount of the paint.
Output:
enter length of room:
10
enter width of room:
8
enter height of room:
12
enter amount of a gallon:
15
total square footage of walls to be painted : 380
total amount of paint is: 47.5