In: Computer Science
Use c#
Create a program called ResortPrices that prompts the
user to enter the
number of days for a resort stay. Then display the price per night
and the total
price. Nightly rates are R 500.00 for one or two nights, R 650.00
for three or
four nights, R 850.00 for five, six or seven nights, and R 1500.00
for eight
nights or more.
Code:
using System;
class ResortPrices
{
static void Main()
{
Console.WriteLine("Enter no.of days");
int days = Convert.ToInt32(Console.ReadLine());
int price,total_price;
if(days==1 || days==2)
{
price=500;
}
else if(days==3||days==4)
{
price=650;
}
else if(days==5||days==6||days==7)
{
price=850;
}
else
{
price=1500;
}
total_price=price*days;
Console.WriteLine("Price per night= "+price);
Console.WriteLine("Total price= "+total_price);
}
}
Screenshots: