Exemplo n.º 1
0
        static void Main(string[] args)
        {
            // f**k denna koden :DDD!!!!!!!!!!!!!!!!!!!!! kul
            // Allt den saknar är att lägga till produkt på person, koden må vara hemsk men den funkar ju weeeeeee.

            Kund Bogdan = new Kund("Bogdan");
            Kund Bruh   = new Kund("Bruh");
            Kund Bob    = new Kund("Bogdan");

            Pillow Obama = new Pillow("Black", "Large", "Cube");
            Pillow Trump = new Pillow("Orange", "Medium", "Tomato");
            Pillow Rorri = new Pillow("Red", "Extra Large", "Car");
            Pillow Shrek = new Pillow("Green", "Small", "Ogre");

            int loop = 1;

            while (loop == 1)
            {
                StartMenu();

                int userselect = Convert.ToInt32(Console.ReadLine());


                switch (userselect)
                {
                case 1:

                    Console.WriteLine("You are nog logged in with user Bogdan");

                    PillowMenu();

                    int pillowselect = 0;
                    pillowselect = Convert.ToInt32(Console.ReadLine());

                    switch (pillowselect)
                    {
                    case 1:
                        Obama.Description();
                        PillowConfirmation();
                        int confirmation = 0;
                        confirmation = Convert.ToInt32(Console.ReadLine());

                        switch (confirmation)
                        {
                        case 1:
                            Console.WriteLine("Succesfully added to cart! Returning to user selection screen");
                            break;

                        case 2:
                            Console.WriteLine("Pillow not added to card, returning to pillow selection screen");
                            break;
                        }

                        break;

                    case 2:
                        Trump.Description();
                        PillowConfirmation();
                        confirmation = Convert.ToInt32(Console.ReadLine());

                        switch (confirmation)
                        {
                        case 1:
                            Console.WriteLine("Succesfully added to cart! Returning to pillow selection screen");
                            break;

                        case 2:
                            Console.WriteLine("Pillow not added to card, returning to pillow selection screen");
                            break;
                        }
                        break;

                    case 3:
                        Rorri.Description();
                        PillowConfirmation();
                        confirmation = Convert.ToInt32(Console.ReadLine());

                        switch (confirmation)
                        {
                        case 1:
                            Console.WriteLine("Succesfully added to cart! Returning to pillow selection screen");
                            break;

                        case 2:
                            Console.WriteLine("Pillow not added to card, returning to pillow selection screen");
                            break;
                        }
                        break;

                    case 4:
                        Shrek.Description();
                        PillowConfirmation();
                        confirmation = Convert.ToInt32(Console.ReadLine());

                        switch (confirmation)
                        {
                        case 1:
                            Console.WriteLine("Succesfully added to cart! Returning to pillow selection screen");
                            break;

                        case 2:
                            Console.WriteLine("Pillow not added to card, returning to pillow selection screen");
                            break;
                        }
                        break;
                    }

                    break;

                case 2:
                    Console.WriteLine("You are nog logged in with user Bruh");
                    PillowMenu();

                    pillowselect = Convert.ToInt32(Console.ReadLine());


                    switch (pillowselect)
                    {
                    case 1:
                        Obama.Description();
                        PillowConfirmation();
                        int confirmation = 0;
                        confirmation = Convert.ToInt32(Console.ReadLine());

                        switch (confirmation)
                        {
                        case 1:
                            Console.WriteLine("Succesfully added to cart! Returning to pillow selection screen");
                            break;

                        case 2:
                            Console.WriteLine("Pillow not added to card, returning to pillow selection screen");
                            break;
                        }

                        break;

                    case 2:
                        Trump.Description();
                        PillowConfirmation();
                        confirmation = Convert.ToInt32(Console.ReadLine());

                        switch (confirmation)
                        {
                        case 1:
                            Console.WriteLine("Succesfully added to cart! Returning to pillow selection screen");
                            break;

                        case 2:
                            Console.WriteLine("Pillow not added to card, returning to pillow selection screen");
                            break;
                        }
                        break;

                    case 3:
                        Rorri.Description();
                        PillowConfirmation();
                        confirmation = Convert.ToInt32(Console.ReadLine());

                        switch (confirmation)
                        {
                        case 1:
                            Console.WriteLine("Succesfully added to cart! Returning to pillow selection screen");
                            break;

                        case 2:
                            Console.WriteLine("Pillow not added to card, returning to pillow selection screen");
                            break;
                        }
                        break;

                    case 4:
                        Shrek.Description();
                        PillowConfirmation();
                        confirmation = Convert.ToInt32(Console.ReadLine());

                        switch (confirmation)
                        {
                        case 1:
                            Console.WriteLine("Succesfully added to cart! Returning to pillow selection screen");
                            break;

                        case 2:
                            Console.WriteLine("Pillow not added to card, returning to pillow selection screen");
                            break;
                        }
                        break;
                    }

                    break;

                case 3:
                    Console.WriteLine("You are nog logged in with user Bob");
                    PillowMenu();

                    pillowselect = Convert.ToInt32(Console.ReadLine());


                    switch (pillowselect)
                    {
                    case 1:
                        Obama.Description();
                        PillowConfirmation();
                        int confirmation = 0;
                        confirmation = Convert.ToInt32(Console.ReadLine());

                        switch (confirmation)
                        {
                        case 1:
                            Console.WriteLine("Succesfully added to cart! Returning to pillow selection screen");
                            break;

                        case 2:
                            Console.WriteLine("Pillow not added to card, returning to pillow selection screen");
                            break;
                        }

                        break;

                    case 2:
                        Trump.Description();
                        PillowConfirmation();
                        confirmation = Convert.ToInt32(Console.ReadLine());

                        switch (confirmation)
                        {
                        case 1:
                            Console.WriteLine("Succesfully added to cart! Returning to pillow selection screen");
                            break;

                        case 2:
                            Console.WriteLine("Pillow not added to card, returning to pillow selection screen");
                            break;
                        }
                        break;

                    case 3:
                        Rorri.Description();
                        PillowConfirmation();
                        confirmation = Convert.ToInt32(Console.ReadLine());

                        switch (confirmation)
                        {
                        case 1:
                            Console.WriteLine("Succesfully added to cart! Returning to pillow selection screen");
                            break;

                        case 2:
                            Console.WriteLine("Pillow not added to card, returning to pillow selection screen");
                            break;
                        }
                        break;

                    case 4:
                        Shrek.Description();
                        PillowConfirmation();
                        confirmation = Convert.ToInt32(Console.ReadLine());

                        switch (confirmation)
                        {
                        case 1:
                            Console.WriteLine("Succesfully added to cart! Returning to pillow selection screen");
                            break;

                        case 2:
                            Console.WriteLine("Pillow not added to card, returning to pillow selection screen");
                            break;
                        }
                        break;
                    }

                    break;
                }
            }
        }
Exemplo n.º 2
0
        public void nyOrder()
        {
            List <Produkt> produktlista = new List <Produkt>();

            produktlista.Add(new Produkt("Barkis", 15.95));
            produktlista.Add(new Produkt("Levain", 32.50));
            produktlista.Add(new Produkt("Lingongrova", 30.50));
            produktlista.Add(new Produkt("Rågkaka", 29.50));

            Console.Clear();

            Console.WriteLine("Produklista:");

            var amountProducts = 0;

            foreach (Produkt produkter in produktlista)
            {
                Console.WriteLine("[" + amountProducts + "] " + produkter.namn);
                Console.WriteLine(produkter.kostnad + "kr");
                Console.WriteLine();
                amountProducts++;
            }

            Console.WriteLine("Produkter Obs! Skriv in produktnamn och antal av produkt t.ex. 1 12");

            var           fortsätt         = true;
            var           gånger           = 0;
            var           produktVal       = 0;
            var           produktKvantitet = 0;
            var           total            = 0.00;
            List <string> totalProdukter   = new List <string>();
            List <double> totalKostnad     = new List <double>();


            while (fortsätt)
            {
                var      productChoice = Console.ReadLine();
                String   spearator     = " ";
                String[] productInput  = productChoice.Split(spearator, 2);
                produktVal       = Convert.ToInt32(productInput[0]);
                produktKvantitet = Convert.ToInt32(productInput[1]);

                gånger++;
                Console.WriteLine("Vill du lägga till fler produkter?");
                Console.WriteLine("[true/false]");
                fortsätt = Convert.ToBoolean(Console.ReadLine());

                totalProdukter.Add(produktlista[produktVal].namn);
                total = total + produktlista[produktVal].kostnad * produktKvantitet;
            }

            foreach (string abc in totalProdukter)
            {
                Console.WriteLine(abc);
            }

            Console.WriteLine("Total:");
            Console.WriteLine(total + " kr");

            Kund kund1 = new Kund(totalProdukter, total);

            kund1.nyKund();
        }