I was wondering if someone would be willing to assist me. The program listed below compiles, but when I run it I get the following error an exception 'System.FormatException.
I think my error is possibly convertinting the string in the readLine to a boolean inorder to test the true false in my if statements.
using System;
public class HotDogSales
{
public static void Main()
{
const double basicDogPrice = 2.00;
const double chiliPrice = 0.69;
const double cheesePrice = 0.49;
string wantChiliBool, wantCheeseBool;
bool wantChili, wantCheese;
double price;
bool Y = true, y = true;
Console.Write("Do you want chili on your dog?" );
wantChiliBool = Console.ReadLine();
wantChili = Convert.ToBoolean(wantChiliBool);
Console.Write("Do you want cheese on your dog?" );
wantCheeseBool = Console.ReadLine();
wantCheese = Convert.ToBoolean(wantCheeseBool);
if(wantChili = Y || y && wantCheese == Y || y)
{
price = basicDogPrice + chiliPrice + cheesePrice;
}
else if(wantChili = Y || y)
{
price = basicDogPrice + chiliPrice;
}
else if (wantCheese = Y || y)
}
price = basicDogPrice + cheesePrice;
}
else
price = basicDogPrice;
Console.WriteLine("Your total is {0}", price.ToString("C"));
}
}