+ResortPrices.cs Instructions Write a program for The Carefree Resort named Reso
ID: 3725580 • Letter: #
Question
+ResortPrices.cs Instructions Write a program for The Carefree Resort named ResortPrices that prompts the user to enter the number of days for a resort stay. Then display the price per night and the6 total price. Nightly rates are 1 ising System; 2 using static Systen.Console; 3 class ResortPrices 4 5 static void Main() // Write your main here 7 8 9 $200 for one or two nights $180 for three or four nights $160 for five, six, or seven nights $145 for eight nights or more For example, if the input is 1, the output should be: Price per night is $200.00 Total for 1 night(s) is $200.00Explanation / Answer
using System; class ResortPrices { static void Main() { int numberOfNights = Convert.ToInt32(Console.ReadLine()); double pricePerNight = 200; if(numberOfNights >= 8) { pricePerNight = 145; } else if(numberOfNights >= 5) { pricePerNight = 160; } else if(numberOfNights >= 3) { pricePerNight = 180; } double total = pricePerNight*numberOfNights; Console.WriteLine("Price per night is {0:N2}", pricePerNight); Console.WriteLine("Total for " + numberOfNights.ToString() + " night(s) is ${0:N2}", total); } }
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.