Exemplo n.º 1
0
        // Precondition:  theCopyrightYear >= 0 and theLoanPeriod >= 0 and
        //                theMedium from { DVD, BLURAY, VHS } and theDuration >= 0
        // Postcondition: A library movie has been created with the specified
        //                values for title, publisher, copyright year, loan period,
        //                call number, duration, director, medium, and rating. The
        //                item is not checked out.
        //                The movie has been added to the Library.
        public bool AddLibraryMovie(String theTitle, String thePublisher, int theCopyrightYear,
                                    int theLoanPeriod, String theCallNumber, double theDuration, String theDirector,
                                    LibraryMediaItem.MediaType theMedium, LibraryMovie.MPAARatings theRating)
        {
            // create the new movie object
            LibraryMovie newMovie = new LibraryMovie(theTitle, thePublisher, theCopyrightYear,
                                                     theLoanPeriod, theCallNumber, theDuration, theDirector,
                                                     theMedium, theRating);

            // does the callnum exist already?
            if (!libraryItems.ContainsKey(theCallNumber))
            {
                // add the movie to the dict
                libraryItems.Add(theCallNumber, newMovie);

                _items.Add(new LibraryMovie(theTitle, thePublisher, theCopyrightYear, theLoanPeriod,
                                            theCallNumber, theDuration, theDirector, theMedium, theRating));

                return(SUCCESSFUL_ADD);
            }
            else
            {
                return(FAILED_ADD);
            }
        }
Exemplo n.º 2
0
 // Precondition:  theCopyrightYear >= 0 and theLoanPeriod >= 0 and
 //                theMedium from { DVD, BLURAY, VHS } and theDuration >= 0
 // Postcondition: A library movie has been created with the specified
 //                values for title, publisher, copyright year, loan period,
 //                call number, duration, director, medium, and rating. The
 //                item is not checked out.
 //                The movie has been added to the Library.
 public void AddLibraryMovie(String theTitle, String thePublisher, int theCopyrightYear,
     int theLoanPeriod, String theCallNumber, double theDuration, String theDirector,
     LibraryMediaItem.MediaType theMedium, LibraryMovie.MPAARatings theRating)
 {
     _items.Add(new LibraryMovie(theTitle, thePublisher, theCopyrightYear, theLoanPeriod,
         theCallNumber, theDuration, theDirector, theMedium, theRating));
 }