Answer:
Explanation:
Code used will be like
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PaintingWall
{
class Room
{
public int length, width, height,Area,Gallons;
public Room(int l,int w,int h)
{
length = l;
width = w;
height = h;
}
private int getLength()
{
return length;
}
private int getWidth()
{
return width;
}
private int getHeight()
{
return height;
}
public void WallAreaAndNumberGallons()
{
Area = getLength() * getHeight() * getWidth();
if (Area < 350)
{
Gallons = 1;
}
else if (Area > 350)
{
Gallons = 2;
}
Console.WriteLine ("The area of the Room is " + Area);
Console.WriteLine("The number of gallons paint needed to paint the Room is " + Gallons);
}
}
class PaintingDemo
{
static void Main(string[] args)
{
int l, w, h;
Room[] r = new Room[8];
for (int i = 0; i <= 7; i++)
{
Console.WriteLine("Room "+(i+1));
Console.Write("Enter Length : ");
l = Convert.ToInt32(Console.ReadLine() );
Console.Write("Enter Width : ");
w = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter Height : ");
h= Convert.ToInt32(Console.ReadLine());
r[i] = new Room(l,w,h);
Console.WriteLine();
}
for (int i = 0; i <= 7; i++)
{
Console.WriteLine("Room " + (i + 1));
r[i].WallAreaAndNumberGallons();
}
Console.ReadKey();
}
}
}