Ejemplo n.º 1
0
    public static void Main(string[] args)
    {
        Book b1 = new Book("1", "How To Come Up With Names", new Author());
        Book b2 = new Book("2", "My Dog Ate My Computer", new Author());
        Book b3 = new Book("3", "Random Book", new Author());
        Book b4 = new Book("4", "How To Build A Computer", new Author(), DateTime.Parse("5/6/2008"), "Bob Jones Publishing");
        Book b5 = new Book("5", "How To Tie A Knot", new Author(), DateTime.Parse("6/4/2004"), "Publishing Co.");
        Book b6 = new Book("6", "How To Train A Dog", new Author(), DateTime.Parse("3/7/1994"), "Bob Jones Publishing");

        Author bobJones = new Author("Bob", "Jones", "999-99-9999");

        bobJones.Email = "*****@*****.**";
        Author johnDoe = new Author("John", "Doe", "888-88-8888");

        johnDoe.Email = "*****@*****.**";
        bobJones.DisplayInfo();
        johnDoe.DisplayInfo();
        bobJones.AddBook(b1);
        bobJones.AddBook(b3);
        bobJones.AddBook(b5);
        bobJones.DisplayBooks();
        johnDoe.AddBook(b2);
        johnDoe.AddBook(b4);
        johnDoe.AddBook(b6);
        johnDoe.DisplayBooks();
        bobJones.RemoveBook("1");
        bobJones.DisplayBooks();

        /*
         * Part 2
         */
        Patron p1 = new Patron("Alex", "McDonald", "11");
        Patron p2 = new Patron("Robert", "Carpenter", "12");
        Patron p3 = new Patron("James", "Parker", "13");
        Patron p4 = new Patron("Bob", "McDonald", "14");
        Patron p5 = new Patron("Janie", "Wright", "15");

        //p1.AddToRentalCart(b1, DateTime.Today);
        p1.AddToRentalCart(b3, DateTime.Today);
        p1.RemoveFromRentalCart(b3);
        p1.Display();

        /*
         * Part 3
         */
        Console.WriteLine("PART 3");
        LibraryCollection lc = new LibraryCollection();

        lc.AddPatron(p1);
        lc.AddPatron(p2);
        lc.AddPatron(p3);
        lc.AddPatron(p4);
        lc.AddPatron(p5);
        lc.DisplayPatronInfo();
        lc.RemovePatron(p5);
        lc.DisplayPatronInfo();
        lc.AddToCollection(b1);
        lc.AddToCollection(b2);
        lc.AddToCollection(b3);
        lc.AddToCollection(b4);
        lc.AddToCollection(b5);
        lc.AddToCollection(b6);
        lc.DisplayCollection();
        lc.RemoveFromCollection(b5);
        lc.DisplayCollection();
        p1.AddToRentalCart(b1, DateTime.Today); //wasn't specified so I'm using DateTime.Today
        p1.AddToRentalCart(b2, DateTime.Today);
        p1.AddToRentalCart(b3, DateTime.Today);
        p1.RemoveFromRentalCart(b3);
        lc.ProcessRental(p1);
        lc.DisplayCollection();
        lc.ProcessReturns(p1, b2);
        lc.DisplayCollection();
    }
Ejemplo n.º 2
0
    public static void Main(string[] args)
    {
        //Creating 6 Books

        Book b1 = new Book("Something Wicked This Way Comes", "ISBN-0380729407", "Ray Bradbury");
        Book b3 = new Book("The Martian Chronicles", "ISBN-9781451678192", "Ray Bradbury");
        Book b5 = new Book("The October Country: Stories", "ISBN-034532448X", "Ray Bradbury");
        Book b2 = new Book("The Ghost Brigades", "ISBN-B001QS9TSE", "John Scalzi", Convert.ToDateTime("04/10/2010"), "TorBooks");
        Book b4 = new Book("Old Man's War", "ISBN-B000SEIK2S", "John Scalzi", Convert.ToDateTime("04/01/2007"), "TorBooks");
        Book b6 = new Book("The Last Colony", "ISBN-B000YJ85BI", "John Scalzi", Convert.ToDateTime("04/17/2012"), "TorBooks");

        //Author 1
        author Ray = new author("Ray", "Bradbury", "*****@*****.**");

        Ray.DisplayInfo();
        Ray.AddBook(b1);
        Ray.AddBook(b3);
        Ray.AddBook(b5);
        Ray.DisplayBooks();
        Ray.RemoveBook(b1);
        Ray.DisplayBooks();


        //Author 2
        author John = new author("John", "Scalzi", "*****@*****.**");

        John.DisplayInfo();
        John.AddBook(b2);
        John.AddBook(b4);
        John.AddBook(b6);
        John.DisplayBooks();

        Patron p1 = new Patron("Kurt", "Miller", "QWE123");
        Patron p2 = new Patron("Jane", "Kintz", "ASD456");
        Patron p3 = new Patron("Chris", " Fritz", "ZXC789");
        Patron p4 = new Patron("Samuel", "Jackman", "TYU963");
        Patron p5 = new Patron("Shirley", "Slatts", "MLK654");

        LibraryCollection L1 = new LibraryCollection();

        L1.AddPatron(p1);
        L1.AddPatron(p2);
        L1.AddPatron(p3);
        L1.AddPatron(p4);
        L1.AddPatron(p5);
        L1.RemovePatron(p5);
        L1.DisplayPatronInfo();

        L1.AddToCollection(b1);
        L1.AddToCollection(b2);
        L1.AddToCollection(b3);
        L1.AddToCollection(b4);
        L1.AddToCollection(b5);
        L1.AddToCollection(b6);
        L1.RemoveFromCollection(b6);

        L1.DisplayCollection();

        p1.AddToRentalCart(b1, Convert.ToDateTime("04/07/2022"));
        p1.AddToRentalCart(b2, Convert.ToDateTime("04/07/2022"));
        p2.AddToRentalCart(b3, Convert.ToDateTime("04/07/2022"));
        p2.AddToRentalCart(b4, Convert.ToDateTime("04/07/2022"));
        p2.RemoveFromRentalCart(b4);

        L1.ProcessRental(p1);
        L1.ProcessRental(p2);
        L1.DisplayCollection();

        L1.ProcessReturns(p1, b1);
        L1.ProcessReturns(p2, b3);
        L1.DisplayCollection();
    }
Ejemplo n.º 3
0
    public static void Main(string[] args)
    {
//START PART 1
        //creating book objects
        Book book1 = new Book("11223344", "Legend of Drizzt: Homecoming", "R.A. Salvatore");
        Book book2 = new Book("6958490", "The Lion, The Witch, and The Audacity", "Shel B. Cominround");
        Book book3 = new Book("8675309", "Legend of Drizzt: Wulfgar", "R.A. Salvatore");
        Book book4 = new Book("13121312", "Werner Herzogs Wary Hog", "Shel B. Cominround", Convert.ToDateTime("10/02/1997"), "Walrus Publishing");
        Book book5 = new Book("5415424", "Legend of Drizzt: Cattie-Brie", "R.A. Salvatore", Convert.ToDateTime("12/05/1999"), "Gatehouse Books");
        Book book6 = new Book("9875421", "I Ran Out of Book Titles", "Shel B. Cominround", Convert.ToDateTime("10/4/2015"), "Walrus Publishing");

        //creating author objects
        Author a1 = new Author("R.A.", "Salvatore", "*****@*****.**");
        Author a2 = new Author("Shel B.", "Cominround", "*****@*****.**");

        //Author intros
        a1.DisplayInfo();
        a2.DisplayInfo();

        //book displays - testing purposes only

        /*
         * book1.Display();
         * book2.Display();
         * book3.Display();
         * book4.Display();
         * book5.Display();
         * book6.Display();
         *
         *
         * //Author Book Lists - testing purposes only
         * a1.DisplayBooks();
         * a2.DisplayBooks();
         */

        //Adding books to Authors BookLists & Displaying them
        a1.AddBook(book1);
        a1.AddBook(book3);
        a1.AddBook(book5);
        a1.DisplayBooks();
        a2.AddBook(book2);
        a2.AddBook(book4);
        a2.AddBook(book6);
        a2.DisplayBooks();

        //Removing book1 from a1
        a1.RemoveBook("11223344");

        //Displaying Author 1's Books again
        a1.DisplayBooks();
//END PART 1
//START PART 2
        //Creating Patrons
        Patron p1 = new Patron("Jim", "Jones", "7777");
        Patron p2 = new Patron("Shoko", "Asahara", "8888");
        Patron p3 = new Patron("Brigham", "Young", "9999");
        Patron p4 = new Patron("Ed", "Gein", "1111");
        Patron p5 = new Patron("Marshall", "Applewhite", "2222");

        //Adding Book1 to Patron1's rental cart using AddToRentalCart();
        p1.AddToRentalCart(book1, Convert.ToDateTime("10/2/2021"));

        //Removing Book3 from Patron1's rental cart using RemoveFromRentalCart();
        p1.RemoveFromRentalCart(book3);


        //Displaying Patron Info - Test Purposes only

        /*
         * p1.Display();
         * p2.Display();
         * p3.Display();
         * p4.Display();
         * p5.Display();
         */

//END PART 2
//START PART 3
        LibraryCollection lc1 = new LibraryCollection();

        //I wanted to do something like this:
        //foreach (var Patron in PatronList)
        //{
        // lc1.AddPatron(p);
        //}
        //but I couldnt figure out how to access that list in from main.cs
        lc1.AddPatron(p1);
        lc1.AddPatron(p2);
        lc1.AddPatron(p3);
        lc1.AddPatron(p4);
        lc1.AddPatron(p5);
        lc1.DisplayPatronInfo();
        lc1.RemovePatron(p5);
        lc1.DisplayPatronInfo();
        //same story with adding these books, couldnt figure out how to access it. im sure the answer is really simple.
        lc1.AddToCollection(book1);
        lc1.AddToCollection(book2);
        lc1.AddToCollection(book3);
        lc1.AddToCollection(book4);
        lc1.AddToCollection(book5);
        lc1.AddToCollection(book6);
        lc1.DisplayCollection();
        lc1.RemoveFromCollection(book5);
        lc1.DisplayCollection();

        p1.AddToRentalCart(book1, Convert.ToDateTime("12/12/2012"));
        p1.AddToRentalCart(book2, Convert.ToDateTime("12/13/2012"));
        p1.AddToRentalCart(book3, Convert.ToDateTime("12/14/2012"));
        p1.RemoveFromRentalCart(book3);
        lc1.ProcessRental(p1);
        lc1.DisplayCollection();
        //lc1.ProcessReturns(book2, p1);
        //lc1.DisplayCollection();
        //END PART 3
    }
Ejemplo n.º 4
0
    public static void Main(string[] args)
    {
        Book BookOne   = new Book("1000", "Book One", "Author");
        Book BookTwo   = new Book("1001", "Book Two", "Author");
        Book BookThree = new Book("1002", "Book Three", "Author");
        Book BookFour  = new Book("1003", "Book Four", "Author", Convert.ToDateTime("12/02/2020"), "Sophie Publishing");
        Book BookFive  = new Book("1004", "Book Five", "Author", Convert.ToDateTime("12/02/2020"), "Sophie Publishing");
        Book BookSix   = new Book("1005", "Book Six", "Author", Convert.ToDateTime("12/02/2020"), "Sophie Publishing");

        BookOne.Display();
        BookFour.Display();

        Author AuthorOne = new Author("Author", "One");

        AuthorOne.Email = "*****@*****.**";
        AuthorOne.DisplayInfo();
        AuthorOne.AddBook(BookOne);
        AuthorOne.AddBook(BookThree);
        AuthorOne.AddBook(BookFive);
        AuthorOne.DisplayBooks();
        AuthorOne.RemoveBook(BookOne);
        AuthorOne.DisplayBooks();

        Author AuthorTwo = new Author("Author", "Two");

        AuthorTwo.Email = "*****@*****.**";
        AuthorTwo.DisplayInfo();
        AuthorTwo.AddBook(BookTwo);
        AuthorTwo.AddBook(BookFour);
        AuthorTwo.AddBook(BookSix);
        AuthorTwo.DisplayBooks();

        Patron patron1 = new Patron("Patron", "One", "0000");
        Patron patron2 = new Patron("Patron", "Two", "1111");
        Patron patron3 = new Patron("Patron", "Three", "2222");
        Patron patron4 = new Patron("Patron", "Four", "3333");
        Patron patron5 = new Patron("Patron", "Five", "4444");


        patron1.AddToRentalCart(BookOne, Convert.ToDateTime("12/07/2020"));
        patron1.RemoveFromCart(BookOne);

        LibraryCollection librarycollection = new LibraryCollection();

        librarycollection.AddPatron(patron1);
        librarycollection.AddPatron(patron2);
        librarycollection.AddPatron(patron3);
        librarycollection.AddPatron(patron4);
        librarycollection.AddPatron(patron5);

//librarycollection.DisplayPatronInfo();

        librarycollection.RemovePatron(patron5);

//librarycollection.DisplayPatronInfo();

        librarycollection.AddToCollection(BookOne);
        librarycollection.AddToCollection(BookTwo);
        librarycollection.AddToCollection(BookThree);
        librarycollection.AddToCollection(BookFour);
        librarycollection.AddToCollection(BookFive);
        librarycollection.AddToCollection(BookSix);

        librarycollection.DisplayCollection();

        librarycollection.RemoveFromCollection(BookFive);

        librarycollection.DisplayCollection();

        patron1.AddToRentalCart(BookOne, Convert.ToDateTime("12/7/20"));
        patron1.AddToRentalCart(BookTwo, Convert.ToDateTime("12/7/20"));
        patron1.AddToRentalCart(BookThree, Convert.ToDateTime("12/7/20"));
        patron1.RemoveFromCart(BookThree);
//librarycollection.ProcessRental(patron1);
        librarycollection.DisplayCollection();
//librarycollection.ProcessReturns(patron1, BookTwo);
        librarycollection.DisplayCollection();
    }