Click to See Complete Forum and Search --> : need program help in cSharp


alphacentauri
October 25th, 2008, 10:11 PM
THE CODE:

using System;

namespace ProgramOne
{
class ProgramOne
{
static void Main()
{
//Declare variables
double amount, shippingCharge;

//Get the purchase total, calculate shipping charges, and display results
amount = GetAmount();
shippingCharge = DetermineShipCharge();
DisplayResults(amount, shippingCharge);
}

static double GetAmount()
{
//Declare variables
double purchaseTotal;

//Get the amount, parse it, and return it
Console.Write("Please enter the purchase total: ");
purchaseTotal = double.Parse(Console.ReadLine());

//Return the parsed value
return purchaseTotal;
}

static double DetermineShipCharge(double amount)
{
//Declare variables
double shippingCharge;

//Determine shipping charge
if (amount <= 250.00)
shippingCharge = 5.00;
else if (amount >= 250.01)
shippingCharge = 8.00;
else if (amount >= 500.01)
shippingCharge = 10.00;
else if (amount >= 1000.01)
shippingCharge = 15.00;
else if (amount <= 5000.00)
shippingCharge = 15.00;
else
shippingCharge = 20.00;

//Return shipping charge
return shippingCharge;
}

static void DisplayResults(double amount, double shippingCharge)
{
Console.WriteLine("Purchasing {0:C} worth of merchandise results in {1:C} worth of shipping charges.", amount, shippingCharge);
}
}
}


----------------------
first off: the program is supposed to ask for a purchase total then depending on the purchase total amount determine shipping charges then display the shipping charges.

For some reason, in the Main class, in the line "shippingCharge = DetermineShipCharge();", "DetermineShipCharge();" has a blue jagged line under it.. has an error: No overload for method 'DetermineShipCharge' takes '0' arguments
i cant for the life of me figure out whats wrong much less how to correct it. any ideas?

toraj58
October 26th, 2008, 03:13 AM
look, here is the declaration of your method:


static double DetermineShipCharge(double amount)


so it is mandatory to pass a double value to this method when you call it.


double x = 10;
DetermineShipCharge(x);


Touraj Ebrahimi [toraj_e] [at] [yahoo] [dot] [com]

dannystommen
October 26th, 2008, 05:52 AM
in your example

amount = GetAmount();
shippingCharge = DetermineShipCharge(amount);

alphacentauri
October 26th, 2008, 10:50 AM
thank you, i appreciate it

toraj58
October 27th, 2008, 01:51 AM
if your problem is resolved please mark it as resolved.
thanks.

toraj58
October 27th, 2008, 01:53 AM
also please rate the posts.
thanks