ok I am trying to convert find cost per sq yd. in $$.$$ format. I have all the coding correct except it has more than two decimal places.
Here is my code:
//delcare const
const int number = 9;
//declare variable
double length;
double width;
double area;
double cost;
double PricePerSqYd;
double TotalCost;
//input
Console.Write(" Enter length of the room: ");
length = Convert.ToInt32(Console.ReadLine());
Console.Write(" Enter width of the room: ");
width = Convert.ToInt32(Console.ReadLine());
Console.Write(" Enter cost of carpet per square yard: ");
cost = Convert.ToDouble (Console.ReadLine());
//process
area = length * width;
PricePerSqYd = area / number;
TotalCost = PricePerSqYd * cost;
//output
Console.WriteLine("The total cost to carpet your room is " + TotalCost);
Console.ReadLine();