Hi, when i try and debug this it says my itemNumber and itemWeight are unassigned local variables. I clearly have it listed up there. How have i dont this wrong? It is around line 70
using System;
class Program
{
static void Main()
{
const string CATAG = "A", ISLANDSY = "YES";
const string SHIPONE = "Standard", SHIPTWO = "Express", SHIPTHREE = "1-Day";
const double STANDA = 3, STANDB = 1.45;
const double EXPA = 4, EXPB = 2.5;
const double SAMEA = 5.50, SAMEB = 3;
const double SURCHGONE = 2.50, SURCHGTWO = 5, SURCHGTHREE = 8;
string shipping, islands, category;
double itemNumber, itemWeight;
double stanAsur, stanBsur, stanAnoSur, stanBnoSur;
double expAsur, expBsur, expAnoSur, expBnoSur;
double sameAsur, sameBsur, sameAnoSur, sameBnoSur;
//Tell user what this program will do
Console.WriteLine("This program will calculate your shipping costs");
//Ask user what shipping method to use and save the input
Console.WriteLine("Will you be using Standard, Express or 1-Day shipping?");
shipping = (Console.ReadLine());
//Ask the user which catagors the items shipped will be in and save the input
Console.WriteLine("Will your items being shipped be in catagory A or B?");
category = (Console.ReadLine());
//Find out if it is category A or B and save the information given
if (category == CATAG)
{
Console.WriteLine("How many items are in the shipment?");
itemNumber = double.Parse(Console.ReadLine());
}
else
{
Console.WriteLine("How many pounds is your shipment?");
itemWeight = double.Parse(Console.ReadLine());
}
//Ask user if the shipement will be going to Alaska or Hawaii
Console.WriteLine("Will this package be going to Alaska or Hawaii? (Yes or No)");
islands = (Console.ReadLine());
//Calculate everything
//Calculate standard with category A and a surcharge
stanAsur = (STANDA * itemNumber) + SURCHGONE;
//Calculate standard with category B and a surcharge
stanBsur = (STANDB * itemWeight) + SURCHGONE;
//Calculate standard with category A and no surcharge
stanAnoSur = (STANDA * itemNumber);
//Calculate standard with category b and no surcharge
stanBnoSur = (STANDB * itemWeight);
//Calculate express with category A and a surcharge
expAsur = (EXPA * itemNumber) + SURCHGTWO;
//Calculate express with category B and a surcharge
expBsur = (EXPB * itemWeight) + SURCHGTWO;
//Calculate ex[ress with category A and no surcharge
expAnoSur = (EXPA * itemNumber);
//Calculate express with category b and no surcharge
expBnoSur = (EXPB * itemWeight);
//Calculate express with category A and a surcharge
sameAsur = (SAMEA * itemNumber) + SURCHGTHREE;
//Calculate express with category B and a surcharge
sameBsur = (SAMEB * itemWeight) + SURCHGTHREE;
//Calculate ex[ress with category A and no surcharge
sameAnoSur = (SAMEA * itemNumber);
//Calculate express with category b and no surcharge
sameBnoSur = (SAMEB * itemWeight);
if (shipping == SHIPONE && category == CATAG && islands == ISLANDSY)
{
Console.WriteLine("{0}", stanAsur);
}
else if (shipping == SHIPONE && category != CATAG && islands == ISLANDSY)
{
Console.WriteLine("{0}", stanBsur);
}
else if (shipping == SHIPONE && category == CATAG)
{
Console.WriteLine("{0}", stanAsur);
}
else if (shipping == SHIPONE && category != CATAG)
{
Console.WriteLine("{0}", stanBsur);
}
else if (shipping == SHIPTWO && category == CATAG && islands == ISLANDSY)
{
Console.WriteLine("{0}", expAsur);
}
else if (shipping == SHIPTWO && category != CATAG && islands == ISLANDSY)
{
Console.WriteLine("{0}", expBsur);
}
else if (shipping == SHIPTWO && category == CATAG)
{
Console.WriteLine("{0}", expAsur);
}
else if (shipping == SHIPTWO && category != CATAG)
{
Console.WriteLine("{0}", expBsur);
}
else if (shipping == SHIPTHREE && category == CATAG && islands == ISLANDSY)
{
Console.WriteLine("{0}", sameAsur);
}
else if (shipping == SHIPTHREE && category != CATAG && islands == ISLANDSY)
{
Console.WriteLine("{0}", sameBsur);
}
else if (shipping == SHIPTHREE && category == CATAG)
{
Console.WriteLine("{0}", sameAsur);
}
else if (shipping == SHIPTHREE && category != CATAG)
{
Console.WriteLine("{0}", sameBsur);
}
//
Console.ReadLine();
}//End Main()
}//End class Program