Beispiel #1
0
    public static void Main()
    {
        ArrayList QuoteList = new ArrayList();

        while (true)
        {
            char answer;
            Console.Write("Would you like to add a quote? (y/n):\n> ");
            answer = Char.ToLower(Console.ReadLine()[0]);
            while (answer != 'y' && answer != 'n')
            {
                Console.Write("Would you like to add a quote? (y/n):\n> ");
                answer = Char.ToLower(Console.ReadLine()[0]);
            }
            if (answer == 'n')
            {
                Console.WriteLine();
                break;
            }

            Quote newQuote = new Quote();
            newQuote.AskQuestions();
            Console.WriteLine("Here is the total cost from this quote: $" + Math.Round(newQuote.CalculateTotal(), 2) + "\n");
            QuoteList.Add(newQuote);
        }

        // We're finished
        Console.WriteLine("No more quotes for the day, here is how many you have written: " + QuoteList.Count);
    }