Potion Store
Potion Store
class program
{
static void Main(string[] args)
{
int quantity, totalPrice, payment, change, choice, lack;
bool again = true;
while (again)
{
Console.Write("Please enter the designated number for the potion you
wanted to buy: ");
int potion = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("");
if (potion == 1)
{
Console.Write("Enter the quantity of Red Potion you wanted to buy:
");
quantity = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("");
}
else
{
change = payment - totalPrice;
Console.WriteLine("The total price is: " + totalPrice);
Console.WriteLine("Your payment is: " + payment);
Console.WriteLine("Your change is: " + change);
Console.WriteLine("");
}
}
else if (potion == 3)
{
Console.Write("Enter the quantity of Yellow Potion you wanted to
buy: ");
quantity = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("");
}
else
{
change = payment - totalPrice;
Console.WriteLine("The total price is: " + totalPrice);
Console.WriteLine("Your payment is: " + payment);
Console.WriteLine("Your change is: " + change);
Console.WriteLine("");
}
}
else if (potion == 4)
{
Console.Write("Enter the quantity of White Potion you wanted to
buy: ");
quantity = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("");
}
else
{
change = payment - totalPrice;
Console.WriteLine("The total price is: " + totalPrice);
Console.WriteLine("Your payment is: " + payment);
Console.WriteLine("Your change is: " + change);
Console.WriteLine("");
}
}
else if (potion == 5)
{
Console.Write("Enter the quantity of Green Potion you wanted to
buy: ");
quantity = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("");
}
}
else
{
Console.WriteLine("You entered a wrong number, Please try again.");
if (choice == 2)
{
}
}
}