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

What am i doing wrong? it seems easy, but i am having troubles. i am trying to c

ID: 3721589 • Letter: W

Question

What am i doing wrong? it seems easy, but i am having troubles. i am trying to convert to a decimal format.

using System;

namespace PaintEst

{

public class PaintingEstimate

{

public static void Main(String[] args)

{

decimal price;

price = (decimal)GetCost();

Console.WriteLine(" At $6 per sqft, the price to paint this room is {1}.", price.ToString("c"));

}

public static double GetCost()
decimal length;
decimal width;
decimal totalSquareFeet;

{

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

length = Convert.ToDecimal(Console.ReadLine());

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

width = Convert.ToDecimal(Console.ReadLine());

decimal height = 9;

decimaltotalSurfaceArea;

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

double costPerFt = 6;

double totalCost = costPerFt * (decimal)totalSurfaceArea;

Console.WriteLine(" Total Surface Area is {0}", totalSurfaceArea);

return (double)totalCost;

}

}

}

Explanation / Answer

using System.IO;
using System;

namespace PaintEst

{

public class PaintingEstimate

{

public static void Main(String[] args)

{

decimal price;

price =GetCost();

Console.WriteLine(" At $6 per sqft, the price to paint this room is {0}.", price.ToString("c"));

}

public static decimal GetCost()

{

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

length = Convert.ToDecimal(Console.ReadLine());

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

width = Convert.ToDecimal(Console.ReadLine());

decimal height = 9;


decimal totalSurfaceArea = ((length + width) * 2) * height;

decimal costPerFt = 6;

decimal totalCost = costPerFt * totalSurfaceArea;

Console.WriteLine(" Total Surface Area is {0}", totalSurfaceArea);

return totalCost;

}

}

}

Output:

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