Question

    Create a C# program named PaintingDemo that instantiates an array of eight Room objects and...

    Create a C# program named PaintingDemo that instantiates an array of eight Room objects and demonstrates the Room methods. The Room constructor requires parameters for length, width, and height fields; use a variety of values when constructing the objects. The Room class also contains a field for wall area of the Room and number of gallons of paint needed to paint the room. Both of these values are computed by calling private methods. Include read-only properties to get a Room’s values. A room is assumed to have four walls, and you do not need to allow for windows and doors, and you do not need to allow for painting the ceiling. A room requires one gallon of paint for every 350 square feet (plus an extra gallon for any square feet greater than 350). In other words, a 12 x 3 x 10 room with 9-foot ceilings has 396 square feet of wall space, and so requires two gallons of paint.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Output will be like:

Code will be like:

using System;

namespace PaintingDemo
{
class Program
{
static void Main(string[] args)
{
Room obj1 = new Room(5, 7, 20);
Room obj2 = new Room(2, 7, 20);
Room obj3 = new Room(3, 7, 20);
Room obj4 = new Room(4, 7, 20);
Room obj5 = new Room(7, 7, 20);
Room obj6 = new Room(8, 7, 20);
Room obj7 = new Room(9, 7, 20);
Room obj8 = new Room(10, 7, 20);

Console.ReadLine();
}
}
class Room
{
public int length;
public int width;
public int height;


public Room(int len, int width,int heigh)
{
this.length=len;
this.width=width;
this.height=heigh;

wallArea();
Console.WriteLine("Number of gallons of paint needed are "+gallonsOfpaint());

}

private double wallArea()
{
return length * width * height;
}

private double gallonsOfpaint()
{

double paintCount = wallArea()/350;

  
return Math.Ceiling(paintCount);
}
}
}

Please rate it if the above solution helps you in any way or if you have any concerns comment it, I will help you through again.

Add a comment
Know the answer?
Add Answer to:
    Create a C# program named PaintingDemo that instantiates an array of eight Room objects and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Create a program named TilingDemo that instantiates an array of 10 Room objects and demonstrates its...

    Create a program named TilingDemo that instantiates an array of 10 Room objects and demonstrates its methods. The Room constructor requires parameters for length and width fields; use a variety of values when constructing the objects. The Room class also contains a field for floor area of the Room and number of boxes of tile needed to tile the room. Both of these values are computed by calling private methods. A room requires one box of tile for every 12...

  • please explain in C++ only This program determines how much it cost to paint a room...

    please explain in C++ only This program determines how much it cost to paint a room Please write a program which determines and prints out three results. 1. The number of exact gallons of paint to paint the walls and the ceiling (NOT THE FLOOR) of the room if 1 gallon is enough to paint 400 square feet. 2. How many gallons of paint you need to buy since you cannot buy part of a gallon. So if you need...

  • 30. How many gallons of primer and paint are needed to paint the walls of the...

    30. How many gallons of primer and paint are needed to paint the walls of the office? The walls are to receive one coat of primer and two coats of paint. The exterior walls only need paint on the interior sides. The walls are 8 feet high. One gallon of primer will cover 275 square feet and one gallon of paint will cover 350 square feet with a single coat. Do not make deductions for doors. (20 points) MAIN ROOM...

  • 30. How many gallons of primer and paint are needed to paint the walls of the...

    30. How many gallons of primer and paint are needed to paint the walls of the office? The walls are to receive one coat of primer and two coats of paint. The exterior walls only need paint on the interior sides. The walls are 8 feet high. One gallon of primer will cover 275 square feet and one gallon of paint will cover 350 square feet with a single coat. Do not make deductions for doors. (20 points) MAIN ROOM...

  • I need to write a paint job estimator program in python. I have most of it...

    I need to write a paint job estimator program in python. I have most of it down but i keep getting errors and I dont know how to fix it or what im doing worng specs: A painting company has determined that for every 350 square feet of wall space, one gallon of paint and six hours of labor are required. The company charges $62.25 per hour for labor. Write a program call paintjobestimator.py that asks the user to enter...

  • This exercise requires designing a program which solves the problem described in the problem statement below....

    This exercise requires designing a program which solves the problem described in the problem statement below. Provide comments as necessary in your pseudo-code and the Java program. Your solution must include these components: Flowchart Pseudo-code Hierarchy Chart Program Coded Program Output Problem Statement A painting company has determined that to paint 115 square feet of wall space, the task will require one gallon of paint and 8 hours of labor. The company charges $20.00 per hour for labor. Design a...

  • Using C#: Create an application class named BillDemo that instantiates objects of two classes named Bill...

    Using C#: Create an application class named BillDemo that instantiates objects of two classes named Bill and OverdueBill, and that demonstrates all their methods. The Bill class includes auto-implemented properties for the name of the company or person to whom the bill is owed and for the amount due. Also, include a ToString() method and returns a string that contains the name of the class (using GetType()) and the Bill’s data fields values. Create a child class named OverdueBill that...

  • code in C++ Create a program that uses the pass by reference operator instead of the...

    code in C++ Create a program that uses the pass by reference operator instead of the return command. Your main program will need to: create empty variables call void function 1 with no input to display your name to the screen call function 2 to collect the square feet that a gallon of paint covers from user call function 2 to collect the square feet of wall that needs to be painted call function 3 to calculate the number of...

  • CENGAGE MINDTAP gramming Exercise 3-8 PaintCalculator.java Instructions Assume that a gallon of paint covers about 350...

    CENGAGE MINDTAP gramming Exercise 3-8 PaintCalculator.java Instructions Assume that a gallon of paint covers about 350 square feet of wall space. Create an application with a main() method that prompts the user for the length, width, and height of a rectangular room. Pass these three values to a method that does the following: 1 import java.util.Scanner; 2 public class PaintCalculator { 3 public static void main(String args[]) { // Write your code here public static double computeArea double length, double...

  • C# Create an application named JobDemo that declares and uses Job objects. The Job class holds...

    C# Create an application named JobDemo that declares and uses Job objects. The Job class holds job information for a home repair service. The class has five properties that include: JobNumber - The job number Customer - The customer name Description - The job description Hours - The estimated hours price - The price for the job Create a constructor that requires parameters for all the data except price. Include auto-implemented properties for the job number, customer name, and job...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT