Question:
Make a game in C#, in which you can input total number of items, you wanna buy and then write their names along with their price. If you are a Senior Citizen, we will give you 30 % Discount. if not, and you buy from our Shopping center more than 50,000 and within 1,00,000, So we will also give you 20 % Discount and if you buys products more than 1,00,000 $ , then we will give you 30 % discount.
int numitem, price = 0;
double totalprice = 0;
Console.WriteLine("Enter Number of Item(s): ");
numitem = Convert.ToInt32(Console.ReadLine());
for(int i=1;i<=numitem;i++)
{
Console.WriteLine("Enter Item Name: ");
string itemname = Console.ReadLine();
Console.WriteLine("Enter Item Price: ");
price = int.Parse(Console.ReadLine());
totalprice += price;
}
Console.WriteLine();
Console.WriteLine("Are you Senior Citizen : \nif Yes press 1\t\tif No press 0");
int Senior = int.Parse(Console.ReadLine());
if(Senior==1)
{
totalprice = totalprice - (totalprice * 0.3);
Console.WriteLine("You have to pay " + totalprice + " Rupees.");
}
else if(Senior==0)
{
if(totalprice >= 50000 && totalprice <= 100000)
{
totalprice = totalprice - (totalprice * 0.2);
Console.WriteLine("You have to pay " + totalprice + " Rupees.");
}
else if(totalprice>100000)
{
totalprice = totalprice - (totalprice * 0.3);
Console.WriteLine("You have to pay " + totalprice + " Rupees.");
}
else
{
Console.WriteLine("You have to pay " + totalprice + " Rupees.");
}
}
}