using static System.Console;
/// <summary>
/// # # # # # # # # # # # # #
/// # Mark Hesser           #
/// # Jan 18, 18            #
/// # Painting Estimates    #
/// # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
/// # Instructions:                                                                                     #
/// # Create a program named PaintingEstimate whose Main() method prompts a user for length and width   #
/// # of a room in feet. Create a method that accepts the values and then computes the cost of painting #
/// # the room, assuming the room is rectangular and has four full walls and 9-foot ceilings. The price #
/// # of the job is $6 per square foot. Return the price to the Main() method, and display it.          #
/// # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
/// </summary>
namespace PaintingEstimate
{
    class Paint
    {
        static void Main(string[] args)
        {
            #region Declarations
            double roomWidth = 0, roomLength = 0, sqFt = 0, jobTotal;
            bool quit = false;
            #endregion
Title = "Paint Estimate";
            while (!quit)
            {
                Clear();
                WriteLine("\t\t\t Paint Estimate");
                WriteLine("\n Please enter the Length and Width of the room in feet that needs painted.\n");
                //User Input for Length
                Write(" Length: ");
                while (!Double.TryParse(ReadLine(), out roomLength)) //Error Checking
                {
                    WriteLine("That is not a number… Please Try Again!");
                    Write(" Length: ");
                }
                //User Input for Width
                Write("  Width: ");
                while (!Double.TryParse(ReadLine(), out roomWidth)) //Error Checking
                {
                    WriteLine(" That is not a number… Please Try Again!");
                    Write("  Width: ");
                }
                //This Calculates the Total paintable square footage
                CalculateSqFt(out sqFt, roomWidth, roomLength);
                //This Calculates the Total Cost based on a 9 foot ceiling with the rate of $9 per square foot
                CalculatePrice(out jobTotal, sqFt);
//This Displays the Total Cost of the Job
WriteLine("\n The Total Cost to paint {0}SqFt is {1:C}", sqFt, jobTotal);
                Quit(ref quit);
            }
        }
        /// <summary>
        /// This Method calculates the total sqft of the paintable wall space,
        /// assuming the room is rectangular and has four 4 walls and 9-foot ceilings.
        /// </summary>
        /// <param name="sqFt"></param>
        /// <param name="width"></param>
        /// <param name="length"></param>
        /// <returns></returns>
        static double CalculateSqFt(out double sqFt, double width, double length)
        {
            const double height = 9;
            sqFt = (((length * height) * 2) + ((width * height) * 2));
            return sqFt;
        }
        /// <summary>
        /// This Method uses the sqFt value from Main and then computes the cost of painting the room.
        /// </summary>
        /// <param name="Width"></param>
        /// <param name="Length"></param>
        /// <returns></returns>
        static double CalculatePrice(out double total, double sqFt)
        {
            const double priceSqFt = 6;
            total = sqFt * priceSqFt;
            return total;
        }
        /// <summary>
        /// This Method asks the user if they would like to enter another estimate.
        /// </summary>
        static void Quit(ref bool quit)
        {
            ConsoleKeyInfo kb;
            //Asks the user if they would like to enter another estimate.
            Write("\n Would you like to Enter another Estimate? (y/n) ");
            #region Quit?
            kb = ReadKey(); //Listens for Key
            if (kb.Key == ConsoleKey.N) //Ends the Program
            {
                quit = true;
            }
            else if (kb.Key == ConsoleKey.Y)
            {
                quit = false;
            }
            else //Tells the User they are stupid and then Quits the program
            {
                WriteLine("\n You didn’t hit Y or N. " +
                    "\n I’m going to assume you said No. " +
                    "\n Press Any Key Quit…\a");
                ReadKey();
                quit = true; //Ends Program
            }
            #endregion
        }
    }
}
[/code]

