Can anyone help figure out what I am doing wrong? I'm trying to pass value and calculate cost
using System;
namespace Lab4
{
class Carpet
{
static void Main()
{
// Declaring Variables
double cost=0;
double price=0;
GetLength(length);
GetWidth(width);
GetPricePerSquareFeet(price);
CalcCostOfCarpet(length, width, price, cost);
DisplayCostOfCarpet(cost);
}
static double GetLength(double length)
{
string userin;
Console.WriteLine("Please enter Length:");
userin = Console.ReadLine();
length = Convert.ToDouble(userin);
return length;
} //end GetLength
static double GetWidth(double width)
{ // start GetWidth
string userin;
Console.WriteLine("Please enter Width:");
userin = Console.ReadLine();
width = Convert.ToDouble(userin);
return width;
}// end GetWidth
static double GetPricePerSquareFeet(double price)
{ // start GetPricePerYard
string userin;
Console.WriteLine("Please enter Price per square yard:");
userin = Console.ReadLine();
price = Convert.ToDouble(userin);
return price;
} // end GetPricePerSquareYard
static double CalcCostOfCarpet(double length, double width, double price, double cost)
{ // start calculate carpet
cost = (length * width) / 9 * price;
return cost;
}// end calculate carpet
static void DisplayCostOfCarpet(double cost)
{ // start DisplayCostOFCarpet
Console.WriteLine("Cost of Carpet{0:C}",cost);
Console.WriteLine("Press Return to Continue");
Console.ReadLine();
} // end DisplayCostOfCarpet
}
2006-12-04
13:10:24
·
2 answers
·
asked by
Sad Mom
3