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 area of one wall will be length of the wall times the height of the wall. The price of the job is $6 per square foot.
Submit the .cs file for your painting cost estimating program here. In a separate text file show the inputs you used to test your program and a "hand calculation" that verifies at least one of your inputs. Be sure to include comments in your program, including your name and a description of the program inside the program itself. Also be sure to use meaningful variable names.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PaintingEstimate
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Program computes the cost of painting the room");
//inputs room length and width
Console.Write("Enter room lenght: ");
int lenght = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter room width: ");
int width = Convert.ToInt32(Console.ReadLine());
//calls method
int totalPrice = ComputePrice(lenght, width);
Console.WriteLine("Total price: ${0}", totalPrice);
Console.ReadKey();
}
//method computes work price
static int ComputePrice(int length, int width)
{
//price per square foot
int price = 6;
//ceiling
int ceil = 9;
int totalSquare = width * ceil * 2 + length * ceil * 2;
return price * totalSquare;
}
}
}
Comments
Leave a comment