Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a program named PaintingEstimate whose Main()method prompts a user for le

ID: 3721482 • Letter: C

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 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"));
}
}

Explanation / Answer

using System;

namespace Rextester

{

    public class PaintingEstimate

    {

        public static void Main(String[] args)

        {

            int quantity;

            decimal price;

            quantity = GetQuantity();

            price = (decimal)GetCost();

            Console.WriteLine("Final price for {0} items is {1}.", quantity, price.ToString("c"));

        }

       

        public static int GetQuantity()

        {

            Console.Write("Enter quantity : ");

            int quantity = Convert.ToInt32(Console.ReadLine());

           

            return quantity;

        }

        public static double GetCost()

        {

            Console.Write("What is the Lenth of Wall to Paint?");

            double length = Convert.ToDouble(Console.ReadLine());

            Console.Write("What is the Width of Wall to Paint?");

            double width = Convert.ToDouble(Console.ReadLine());

            double height = 9;

            double wallArea, ceilingArea, totalArea;

            wallArea = 2 * (length + width) * height;

            ceilingArea = length * width;

            totalArea = wallArea + ceilingArea;

            decimal costPerFt = 6;

            decimal totalCost = costPerFt * (decimal)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"));

           

            return (double)totalCost;

        }

    }

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote