Question

Create a C# program named PaintingEstimate whose Main() method prompts a user for length and width...

Create a C# program named PaintingEstimate whose Main() method prompts a user for length and width of a room in feet. Create a method that accepts the values and then computes the cost of painting the room, assuming the room is rectangular and has four full walls and 9-foot ceilings. The price of the job is $6 per square foot. Return the price to the Main() method, and display it.

Homework Answers

Answer #1

Have a look at the below code. I have put comments wherever required for better understanding.

using System;
// create main class
class MainClass {
  // create method to calculate painting cost
  public static int PaintingEstimate(int length, int width){
      return (2*(length+width)*9)*6;
  }
  public static void Main (string[] args) {
    // take user input for length and width
    Console.WriteLine ("Enter length: ");
    int length = Convert.ToInt32(Console.ReadLine());

    Console.WriteLine ("Enter width: ");
    int width = Convert.ToInt32(Console.ReadLine());
    // call the PaintingEstimate function and display on console
    Console.WriteLine ("Cost is : "+PaintingEstimate(length,width));

  }
}

Happy Learning!

Know the answer?
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
Similar Questions
Lab: RectClass (constructor) Code in C++ This program creates a Rectangle object, then displays the rectangle's...
Lab: RectClass (constructor) Code in C++ This program creates a Rectangle object, then displays the rectangle's length, width, and area Define an overloaded constructor and use it when creating the Rectangle object instead of using the setters. Change this program to calculate and display the rectangle's perimeter. Example: In feet, how wide is your house? 20 In feet, how long is your house? 25 The house is 20.00 feet wide. The house is 25.00 feet long. The house has 500.00...
debug the following 1) // The main program calls a method that // prompts for and...
debug the following 1) // The main program calls a method that // prompts for and returns a name start Declarations string usersName name = askUserForName() output "Your name is ", usersName stop string askUserForName() Declarations string name output "Please type your name " input usersName return 2) // The main program passes a user’s entry to // a method that displays a multiplication table // using the entered value. The table includes the // value multiplied by every factor...
In Assignment 1, you created a program for Marshall’s Murals that prompts a user for the...
In Assignment 1, you created a program for Marshall’s Murals that prompts a user for the number of interior and exterior murals scheduled to be painted during the next month. The program computes the expected revenue for each type of mural when interior murals cost $500 each and exterior murals cost $750 each. In this assignment, you are going to design a GUI version using Visual Studio Form. The programs prompt a user for the number of interior and exterior...
Question: Squares. Write a program class named SquareDisplay that asks the user for a positive integer...
Question: Squares. Write a program class named SquareDisplay that asks the user for a positive integer no greater than 15. The program should then display a square on the screen using the character ‘X’. The number entered by the user will be the length of each side of the square. For example, if the user enters 5, the program should display the following:       XXXXX       XXXXX       XXXXX       XXXXX       XXXXX INPUT and PROMPTS. The program prompts for an integer as follows: "Enter...
Your assignment is to implement a computer program in C++ to implement the below application. According...
Your assignment is to implement a computer program in C++ to implement the below application. According to Dummies.com the following algorithm determines the amount of paint you need to paint the walls of a four-sided room: 1. Add together the length of each wall. (For example, if each of the four walls are 14, 20, 14, 20 feet respectively then the total length is 14 + 20 + 14 + 20 = 68 feet) 2. Multiply the sum by the...
In C++ Employee Class Write a class named Employee (see definition below), create an array of...
In C++ Employee Class Write a class named Employee (see definition below), create an array of Employee objects, and process the array using three functions. In main create an array of 100 Employee objects using the default constructor. The program will repeatedly execute four menu items selected by the user, in main: 1) in a function, store in the array of Employee objects the user-entered data shown below (but program to allow an unknown number of objects to be stored,...
Program Description A local company has requested a program to calculate the cost of different hot...
Program Description A local company has requested a program to calculate the cost of different hot tubs that it sells. Use the following instructions to code the program: File 1 - HotTubLastname.java Write a class that will hold fields for the following: The model of the hot tub The hot tub’s feature package (can be Basic or Premium) The hot tub’s length (in inches) The hot tub’s width (in inches) The hot tub’s depth (in inches) The class should also...
PLEASE USING C# TO SOLVE THIS PROBLEM. THANK YOU SO MUCH! a. Create a project with...
PLEASE USING C# TO SOLVE THIS PROBLEM. THANK YOU SO MUCH! a. Create a project with a Program class and write the following two methods (headers provided) as described below: - A Method, public static int InputValue(int min, int max), to input an integer number that is between (inclusive) the range of a lower bound and an upper bound. The method should accept the lower bound and the upper bound as two parameters and allow users to re-enter the number...
Delta airlines case study Global strategy. Describe the current global strategy and provide evidence about how...
Delta airlines case study Global strategy. Describe the current global strategy and provide evidence about how the firms resources incompetencies support the given pressures regarding costs and local responsiveness. Describe entry modes have they usually used, and whether they are appropriate for the given strategy. Any key issues in their global strategy? casestudy: Atlanta, June 17, 2014. Sea of Delta employees and their families swarmed between food trucks, amusement park booths, and entertainment venues that were scattered throughout what would...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT