Question: Create a program named PaintingEstimate whose Main()method prompts a user for length and width of a room in feet. Create a method that accepts the
Create a 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.
Am i on the right path? Please advise.
using System; using static System.Console; class PaintingEstimate { static void Main() { int quantity; decimal price; quantity = GetQuantity(); price = GetCost(int quantity); WriteLine("Final price for {0} items is {1}.", quantity, price.ToString("c")); } public static doubleGetCost(int length, int width) { Console.Write("What is the Lenth of Wall to Paint?"); length = Convert.ToDouble(Length); Console.Write("What is the Width of Wall to Paint?"); width = Convert.ToDouble(Width); height = 9; double wallArea, ceilingArea, totalArea; wallArea = 2 * (length + width) * height; ceilingArea = length * width; totalArea = wallArea + ceilingArea; decimal costPerFt = 6; decimal totalCost; totalCost = costPerFt * totalArea; Console.WriteLine("WallArea is {0}", wallArea); Console.WriteLine("CeilingArea is {0}", ceilingArea); Console.WriteLine("TotalArea is {0}", totalArea); Console.WriteLine("TotalCost is {0}", totalCost.ToString("c")); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
