lundi 3 février 2020

C# Listing a double when it's inside an if/else statement [closed]

I'm still learning true/false statements in my C# class, however I've been stumped on the last part I need before finishing a project. I can't seem to get my double "two" to be in a Console.WriteLine below due to it's being inside of an if/else statement. How would someone be able to change the formatting of "two" into something list-able inside of the WriteLine?

bool livery = one > 4800;
Console.WriteLine("Do you require delivery? Y/N: ");
del = Console.ReadLine().ToLower();
del.Trim();
if (livery == true)
{
   two = one * 0;
}
else if (del == "y") 
{
    two = one + (one * 0.03);
}
gst = one * 0.05;
total = one + (one * 0.05);

Console.WriteLine("Total: {0:0.00}", total);
Console.WriteLine("Subtotal: {0:0.00}", subtotal);
Console.WriteLine("GST: {0:0.00}", gst);
Console.WriteLine("Delivery: {0}", two);

Aucun commentaire:

Enregistrer un commentaire