예제 #1
0
        static void RemoveFromOrder(Customer customer)
        {
            do
            {
                Console.Clear();

                Console.WriteLine("Remove From Order:");
                Console.WriteLine("1) Flashlight total is {0}", (flashlight * 15.00).ToString("C"));
                Console.WriteLine("2) iPhone 7 total is {0}", (iphone * 700.00).ToString("C"));
                Console.WriteLine("3) Printer total is {0}", (printer * 80.00).ToString("C"));
                Console.WriteLine("4) Dell Laptop total is {0}", (laptop * 500.00).ToString("C"));
                Console.WriteLine("5) Playstation 4 total is {0}", (playstation * 380.00).ToString("C"));

                switch (ConsoleHelper.ReadInt32(0, 5))
                {
                    case 0: break;
                    case 1:
                        double input1;
                        string inputString1;
                        Console.WriteLine("How many flashlights do you want to remove?");
                        inputString1 = Console.ReadLine();
                        input1 = Convert.ToDouble(inputString1);
                        flashlight -= input1;  //sets a counter for removing
                        break;
                    case 2:
                        double input2;
                        string inputString2;
                        Console.WriteLine("How many iPhone 7 do you remove?");
                        inputString2 = Console.ReadLine();
                        input2 = Convert.ToDouble(inputString2);
                        iphone -= input2;
                        break;

                    case 3:
                        double input3;
                        string inputString3;
                        Console.WriteLine("How many Printers do you remove?");
                        inputString3 = Console.ReadLine();
                        input3 = Convert.ToDouble(inputString3);
                        printer -= input3;
                        break;
                    case 4:
                        double input4;
                        string inputString4;
                        Console.WriteLine("How many Dell Laptops do you remove?");
                        inputString4 = Console.ReadLine();
                        input4 = Convert.ToDouble(inputString4);
                        laptop += input4;
                        break;
                    case 5:
                        double input5;
                        string inputString5;
                        Console.WriteLine("How many Playstion 4 do you remove?");
                        inputString5 = Console.ReadLine();
                        input5 = Convert.ToDouble(inputString5);
                        playstation += input5;
                        break;

                };

            } while (true);
        }
예제 #2
0
        public static void AddToOrder(Customer id)
        {
            Console.Clear();

            int numberOfInputForFlashlight = 0;
            int numberOfInputForIphone = 0;
            int numberOfInputForPrinter = 0;
            int numberOfInputForLaptop = 0;
            int numberOfInputForPlaystation = 0;

            int myint = -1;

            while (myint != 0)
            {
                string group;

                Console.WriteLine("Add To Order");
                Console.WriteLine("1) Flashlight");
                Console.WriteLine("2) iPhone 7");
                Console.WriteLine("3) Printer");
                Console.WriteLine("4) Dell Laptop");
                Console.WriteLine("5) Playstation 4");
                Console.WriteLine("6) View Total");

                Console.WriteLine("[Press 0 to quit]");

                group = Console.ReadLine();
                myint = Int32.Parse(group);

                switch (myint)
                {
                    case 0:
                        break;
                    case 1:
                        double input1;
                        string inputString1;
                        Console.WriteLine("How many flashlights do you want?");
                        inputString1 = Console.ReadLine();
                        input1 = Convert.ToDouble(inputString1);
                        flashlight += input1; //sets a counter
                        numberOfInputForFlashlight++;
                        break;
                    case 2:
                        double input2;
                        string inputString2;
                        Console.WriteLine("How many iPhone 7 do you want?");
                        inputString2 = Console.ReadLine();
                        input2 = Convert.ToDouble(inputString2);
                        iphone += input2;
                        numberOfInputForIphone++;
                        break;
                    case 3:
                        double input3;
                        string inputString3;
                        Console.WriteLine("How many Printers do you want?");
                        inputString3 = Console.ReadLine();
                        input3 = Convert.ToDouble(inputString3);
                        printer += input3;
                        numberOfInputForPrinter++;
                        break;
                    case 4:
                        double input4;
                        string inputString4;
                        Console.WriteLine("How many Dell Laptops do you want?");
                        inputString4 = Console.ReadLine();
                        input4 = Convert.ToDouble(inputString4);
                        laptop += input4;
                        numberOfInputForLaptop++;
                        break;
                    case 5:
                        double input5;
                        string inputString5;
                        Console.WriteLine("How many Playstion 4 do you want?");
                        inputString5 = Console.ReadLine();
                        input5 = Convert.ToDouble(inputString5);
                        playstation += input5;
                        numberOfInputForPlaystation++;
                        break;
                    case 6:  //views the total
                        Console.WriteLine("Flashlist quantity is {0}", flashlight.ToString("F"));
                        Console.WriteLine("iPhone 7 quantity is {0}", iphone.ToString("F"));
                        Console.WriteLine("Printer quantity is {0}", printer.ToString("F"));
                        Console.WriteLine("Dell Laptop quantity is {0}", laptop.ToString("F"));
                        Console.WriteLine("Playstation 4 quantity is {0}", playstation.ToString("F"));
                        Console.WriteLine("Flashlight total is {0}", (flashlight * 15.00).ToString("C"));
                        Console.WriteLine("iPhone 7 total is {0}", (iphone * 700.00).ToString("C"));
                        Console.WriteLine("Printer total is {0}", (printer * 80.00).ToString("C"));
                        Console.WriteLine("Dell Laptop total is {0}", (laptop * 500.00).ToString("C"));
                        Console.WriteLine("Playstation 4 total is {0}", (playstation * 380.00).ToString("C"));
                        break;

                    default:
                        Console.WriteLine("Incorrect input", myint);
                        break;
                }
            }

        }