Resort Price Console App

[code language=”csharp”] using System;
using static System.Console;

#region Credit
/// <summary>
/// # # # # # # # # #
/// # Mark Hesser #
/// # Jan 4, 2018 #
/// # Resort Prices #
/// # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
/// # 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 the total price. #
/// # Nightly rates are $200 for one or two nights; $180 for three or four nights; #
/// # $160 for five, six, or seven nights; and $145 for eight nights or more. #
/// # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
/// </summary>
#endregion

namespace ResortPrices
{
class Resort
{
#region Declarations
static double[] PricePerNight = { 200, 200, 180, 180, 160, 160, 160 };
static double PriceAfter7 = 145, totalCost;
static int NumNights;
static bool QuitMain = false;
#endregion

static void Main(string[] args)
{
Console.Title = "The Carefree Resort";
while (!QuitMain) //Loop until user selects No in Quit()
{
Instructions();
PriceLookup();
Quit();
}
}

static void Instructions()
{
Clear(); //Opening Message
WriteLine("Welcome to The Carefree Resort!" +
"\n\nThis program will prompt you for the number of nights the guest is staying" +
"\nand then will give you the price per night and the total cost\n");
}

static void PriceLookup() //Calculates the Total Cost of a Guests Stay and Displays the Price per night
{
Write("Number of Nights the Guest is Staying: ");
while (!Int32.TryParse(ReadLine(), out NumNights)) //Checks to see if the user entered a number
{
WriteLine("That is not a Number, Please Try Again…\n\a"); //Error Message
Write("Enter the Number of Nights the Guest is Staying: ");
}
totalCost = 0; //Initialize total cost

if (NumNights > 0 && NumNights <= 7)
{
totalCost = totalCost + (PricePerNight[NumNights-1] * NumNights);
WriteLine("\nPrice for Each Night: {0:C}", PricePerNight[NumNights-1]);
}
else if (NumNights > 7)
{
totalCost = totalCost + (PriceAfter7 * NumNights);
WriteLine("\nPrice for Each Night: {0:C}", PriceAfter7);
}
else
{
WriteLine("\nNegative Numbers are not valid…");
}

WriteLine("\nTotal Cost: {0:C}", totalCost); //Displays Total Cost of Stay
}

static void Quit()
{
ConsoleKeyInfo kb;
Write("\nWould you like to enter another Guest? (y/n) ");
#region Quit?
kb = Console.ReadKey(); //Listens for Key
if (kb.Key == ConsoleKey.N) //Ends Program
{
QuitMain = true;
}
else if (kb.Key == ConsoleKey.Y) //Restarts the program
{
QuitMain = false;
}
else //Still Quits the program
{
Console.WriteLine("\nYou didn’t hit Y or N."); Console.WriteLine("I’m going to assume you said No.");
Console.WriteLine("Press Any Key Quit"); Console.ReadKey();
QuitMain = true; //Ends Program
}
#endregion
} //Asks the user if they would like to enter another guest
}
}
[/code]