Ejemplo n.º 1
0
        static int Add(int choice, string Pub)
        {
            Book     bookz = new Book();
            Magazine mag   = new Magazine();
            Ticket   tick  = new Ticket();


            if (Pub == "Book")
            {
                Console.WriteLine("Title: ");
                bookz.Title = Console.ReadLine();
                Console.WriteLine("Quantity to Order: ");
                bookz.Copies = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("Price: ");
                bookz.Price = Convert.ToDouble(Console.ReadLine());
                Console.WriteLine("Author: ");
                bookz.Author = Console.ReadLine();

                Books.Add(bookz);
            }

            else if (Pub == "Magazine")
            {
                Console.WriteLine("Title: ");
                mag.Title = Console.ReadLine();
                Console.WriteLine("Quantity to Order: ");
                mag.Copies = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("Price: ");
                mag.Price = Convert.ToDouble(Console.ReadLine());
                Console.WriteLine("Date of Current Issue: ");
                mag.CurrIssue = Console.ReadLine();

                Mags.Add(mag);
            }

            else if (Pub == "Ticket")
            {
                Console.WriteLine("Description: ");
                tick.Description = Console.ReadLine();
                Console.WriteLine("Price: ");
                tick.Price = Convert.ToDouble(Console.ReadLine());
                Console.WriteLine("Client: ");
                tick.Client = Console.ReadLine();

                Tickz.Add(tick);
            }

            return(choice = -1);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            /* Console.WriteLine("Hello World");
             * Publication pub = new Publication();
             * pub.Title = "I Love Programming";
             * pub.Price = 10.99;
             * pub.Copies = 10;*/

            Book book = new Book();

            book.Author = "Thomas Taylor";
            book.Title  = "I Love Java";
            book.Copies = 12;
            book.Price  = 100;

            Book book1 = new Book();

            book1.Author = "Thomas Taylor jr";
            book1.Title  = "I Love Linux : The Lies";
            book1.Copies = 12;
            book1.Price  = 100;


            Magazine mag = new Magazine();

            mag.Title    = "Yessir";
            mag.OrderQty = 10;
            mag.Price    = 19.99;

            Magazine mag1 = new Magazine();

            mag.Title    = "Yesmaam";
            mag.OrderQty = 10;
            mag.Price    = 19.99;

            Books.Add(book);
            Books.Add(book1);
            Mags.Add(mag);
            Mags.Add(mag1);

            /*
             * Console.Write("\n");
             * Console.WriteLine(pub);
             * Console.Write("\n");
             * Console.WriteLine(book);
             *
             * list.Add(book);
             * list.Add(book1);
             *
             * foreach (Publication p in list)
             * {
             *  Console.Write("\n");
             *  Console.WriteLine(p);
             * }*/
            int    choice  = -1;
            int    choice1 = -1;
            string Pub;



            while (choice < 0)
            {
                Console.Write("--------Main--------" +
                              "\n1. Books" +
                              "\n2. Magazines" +
                              "\n3. Tickets" +
                              "\n4. Checkout" +
                              "\n5. Exit \n");
                choice = Convert.ToInt32(Console.ReadLine());

                switch (choice)
                {
                case 1:
                    Console.WriteLine("\n1. Add A Book" +
                                      "\n2. Edit A Book" +
                                      "\n3. Delete A Book" +
                                      "\n4. Sell A Book" +
                                      "\n5. Return to Main Menu" +
                                      "\n What would you like to do?");
                    choice1 = Convert.ToInt32(Console.ReadLine());

                    Pub = "Book";
                    do
                    {
                        // switch statement to control which option the user chooses.
                        switch (choice1)
                        {
                        case 1:
                            choice = Add(choice1, Pub);
                            break;

                        case 2:
                            choice = Edit(choice1, Pub);
                            break;

                        case 3:
                            choice = Delete(choice1, Pub);
                            break;

                        case 4:
                            choice = Sell(choice1, Pub);
                            break;

                        case 5: break;
                        }
                    }while (choice != -1);
                    break;

                case 2:
                    Console.WriteLine("\n1. Add A Magazine" +
                                      "\n2. Edit A Magazine" +
                                      "\n3. Delete A Magazine" +
                                      "\n4. Sell A Magazine" +
                                      "\n5. Return to Main Menu" +
                                      "\n What would you like to do?");
                    choice1 = Convert.ToInt32(Console.ReadLine());

                    Pub = "Magazine";
                    do
                    {
                        // switch statement to control which option the user chooses.
                        switch (choice1)
                        {
                        case 1:
                            choice = Add(choice1, Pub);
                            break;

                        case 2:
                            choice = Edit(choice1, Pub);
                            break;

                        case 3:
                            choice = Delete(choice1, Pub);
                            break;

                        case 4:
                            choice = Sell(choice1, Pub);
                            break;

                        case 5: break;
                        }
                    }while (choice != -1);
                    break;

                case 3:
                    Console.WriteLine("\n1. Add A Ticket" +
                                      "\n2. Edit A Ticket" +
                                      "\n3. Delete A Ticket" +
                                      "\n4. Sell A Ticket" +
                                      "\n5. Return to Main Menu" +
                                      "\n What would you like to do?");
                    choice1 = Convert.ToInt32(Console.ReadLine());

                    Pub = "Ticket";
                    do
                    {
                        // switch statement to control which option the user chooses.
                        switch (choice1)
                        {
                        case 1:
                            choice = Add(choice1, Pub);
                            break;

                        case 2:
                            choice = Edit(choice1, Pub);
                            break;

                        case 3:
                            choice = Delete(choice1, Pub);
                            break;

                        case 4:
                            choice = Sell(choice1, Pub);
                            break;

                        case 5: break;
                        }
                    }while (choice != -1);
                    break;

                case 4:
                    Console.WriteLine("Currently out of order");
                    break;

                case 5: break;
                }
            }
        }
Ejemplo n.º 3
0
// Funtion to Add publications to the lists.
        public void AddAPublication()
        {
            if (boolBook = true)
            {
                //Scanner inputBook = new Scanner(System.in);

                theLine();

                Console.WriteLine("\nAdd A Book\n\n   Enter Author:");
                String author = (Console.ReadLine());

                Console.WriteLine("\n  Quantity to Order:");
                int copies;
                copies = Convert.ToInt32(Console.ReadLine());

                Console.WriteLine("\n  Enter Title:");
                String title = (Console.ReadLine());

                Console.WriteLine("\n  Enter Price:");
                double price;
                price = Convert.ToDouble(Console.ReadLine());

                Book book = new Book(author, copies, price, title);

                books.Add(book);
                activeBook++;
            }
            else if (boolMagazine = true)
            {
                //Scanner inputMag = new Scanner(System.in);

                theLine();

                Console.WriteLine("\nAdd A Magazine\n\n   Enter Title:");
                String title = (Console.ReadLine());

                Console.WriteLine("\n  Enter Price:");
                double price = Convert.ToDouble(Console.ReadLine());

                Console.WriteLine("\n  Quantity to Order:");
                int copies = 0;
                copies = Convert.ToInt32(Console.ReadLine());

                Console.WriteLine("\n  Enter the Date of the Issue:");
                Console.WriteLine("\n  Enter the Year");
                int year = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("\n  Enter the Month");
                int month = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("\n  Enter the Day");
                int      day = Convert.ToInt32(Console.ReadLine());
                DateTime currIssue;
                currIssue = Convert.ToDateTime(year + "/" + month + "/" + day);

                Magazine magazine = new Magazine(title, price, copies, currIssue);

                magazines.Add(magazine);
                activeMagazine++;
            }
            else if (boolDiscMag = true)
            {
                //Scanner inputDicsMag = new Scanner(System.in);

                theLine();

                Console.WriteLine("\nAdd A Disc Magazine\n\n   Enter Title:");
                String title = (Console.ReadLine());

                Console.WriteLine("\n  Enter Price:");
                double price = Convert.ToDouble(Console.ReadLine());

                Console.WriteLine("\n  Quantity to Order:");
                int copies = Convert.ToInt32(Console.ReadLine());

                Console.WriteLine("\n  Enter the Date of the Issue:");
                Console.WriteLine("\n  Enter the Year");
                int year = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("\n  Enter the Month");
                int month = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("\n  Enter the Day");
                int      day = Convert.ToInt32(Console.ReadLine());
                DateTime currIssue;
                currIssue = Convert.ToDateTime(year + "/" + month + "/" + day);

                Magazine discMag = new Magazine(title, price, copies, currIssue);

                discMags.Add(discMag);
                activeDiscMag++;
            }
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            CashTill Sales = new CashTill();

            Book book = new Book();

            book.Author = "Thomas Taylor";
            book.Title  = "Java";
            book.Copies = 12;
            book.Price  = 100;

            Book book1 = new Book();

            book1.Author = "Thomas Taylor jr";
            book1.Title  = "Linux";
            book1.Copies = 12;
            book1.Price  = 100;


            Magazine mag = new Magazine();

            mag.Title     = "Yessir";
            mag.OrderQty  = 10;
            mag.Price     = 19.99;
            mag.CurrIssue = "08-2017";

            Magazine mag1 = new Magazine();

            mag1.Title    = "Yesmaam";
            mag1.OrderQty = 10;
            mag1.Price    = 19.99;

            Books.Add(book);
            Books.Add(book1);
            Mags.Add(mag);
            Mags.Add(mag1);

            int    choice  = -1;
            int    choice1 = -1;
            string Pub;



            while (choice < 0)
            {
                Console.Write("--------Main--------" +
                              "\n1. Books" +
                              "\n2. Magazines" +
                              "\n3. Tickets" +
                              "\n4. Checkout" +
                              "\n5. Exit \n");
                choice = Convert.ToInt32(Console.ReadLine());

                switch (choice)
                {
                case 1:
                    Console.WriteLine("\n1. Add A Book" +
                                      "\n2. Edit A Book" +
                                      "\n3. Delete A Book" +
                                      "\n4. Sell A Book" +
                                      "\n5. Return to Main Menu" +
                                      "\n What would you like to do?");
                    choice1 = Convert.ToInt32(Console.ReadLine());

                    Pub = "Book";
                    do
                    {
                        // switch statement to control which option the user chooses.
                        switch (choice1)
                        {
                        case 1:
                            choice = Add(choice1, Pub);
                            break;

                        case 2:
                            choice = Edit(choice1, Pub);
                            break;

                        case 3:
                            choice = Delete(choice1, Pub);
                            break;

                        case 4:
                            choice = Sell(choice1, Pub, Sales);
                            break;

                        case 5: break;
                        }
                    }while (choice != -1);
                    break;

                case 2:
                    Console.WriteLine("\n1. Add A Magazine" +
                                      "\n2. Edit A Magazine" +
                                      "\n3. Delete A Magazine" +
                                      "\n4. Sell A Magazine" +
                                      "\n5. Return to Main Menu" +
                                      "\n What would you like to do?");
                    choice1 = Convert.ToInt32(Console.ReadLine());

                    Pub = "Magazine";
                    do
                    {
                        // switch statement to control which option the user chooses.
                        switch (choice1)
                        {
                        case 1:
                            choice = Add(choice1, Pub);
                            break;

                        case 2:
                            choice = Edit(choice1, Pub);
                            break;

                        case 3:
                            choice = Delete(choice1, Pub);
                            break;

                        case 4:
                            choice = Sell(choice1, Pub, Sales);
                            break;

                        case 5: break;
                        }
                    }while (choice != -1);
                    break;

                case 3:
                    Console.WriteLine("\n1. Add A Ticket" +
                                      "\n2. Edit A Ticket" +
                                      "\n3. Delete A Ticket" +
                                      "\n4. Sell A Ticket" +
                                      "\n5. Return to Main Menu" +
                                      "\n What would you like to do?");
                    choice1 = Convert.ToInt32(Console.ReadLine());

                    Pub = "Ticket";
                    do
                    {
                        // switch statement to control which option the user chooses.
                        switch (choice1)
                        {
                        case 1:
                            choice = Add(choice1, Pub);
                            break;

                        case 2:
                            choice = Edit(choice1, Pub);
                            break;

                        case 3:
                            choice = Delete(choice1, Pub);
                            break;

                        case 4:
                            choice = Sell(choice1, Pub, Sales);
                            break;

                        case 5: break;
                        }
                    }while (choice != -1);
                    break;

                case 4:
                    Console.WriteLine("Currently out of order");
                    break;

                case 5: break;
                }
            }
        }