Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Produce a Java program that does the following: Media hierarchy: Classes for Media, EBook, MovieDVD, and MusicCD Add an attribute to Media class

Produce a Java program that does the following: 

Media hierarchy: 

· Classes for Media, EBook, MovieDVD, and MusicCD 

· Add an attribute to Media class to store indication when media object is rented versus available. Add code to constructor and create get and set methods as appropriate. 

· Add any additional constructors and methods needed to support the below functionality 

 

Utilize a Manager class that does the following:

· stores a list of Media objects 

· has functionality to load Media objects from files 

· creates/updates Media files 

· has functionality to add new Media object to its Media list 

· has functionality to find all media objects for a specific title and returns that list 

· has functionality to rent Media based on id (updates rental status on media, updates file, returns rental fee) Implement MediaRentalSystem which has the following functionality: 

· user interface which is either menu driven through console commands. Ensure screen shots of inputs match and get the same result as seen in the sample user interface below.

· selection to load Media files from a given directory (user supplies directory) 

· selection to find a media object for a specific title value (user supplies title and should display to user the media information once it finds it - should find all media with that title) 

· selection to rent a media object based on its id value (user supplies id and should display rental fee value to the user) 

· selection to exit program

 

The Program should throw and catch Java built-in and user-defined exceptions as appropriate

Your classes must be coded with correct encapsulation: private/protected attributes, get methods, and set methods and value validation 

 

There should be appropriate polymorphism: overloading, overriding methods, and dynamic binding 

 

Program should take advantage of the inheritance properties as appropriate  

Sample User interface - command driven: Welcome to Media Rental System 1: Load Media objects... 2: Find Media object... 3: Rent Media object... 9: Quit Enter your selection : 1 Enter path (directory) where to load from: blah File cannot be opened: Could not load, no such directory Welcome to Media Rental System 1: Load Media objects... 2: Find Media object... 3: Rent Media object... 9: Quit Enter your selection : 1 Enter path (directory) where to load from: C:/tmp-umuc Welcome to Media Rental System 1: Load Media objects... 2: Find Media object... 3: Rent Media object... 9: Quit Enter your selection : 2 Enter the title: blah There is no media with this title: blah Welcome to Media Rental System 1: Load Media objects... 2: Find Media object... 3: Rent Media object... 9: Quit

Step by Step Solution

3.47 Rating (150 Votes )

There are 3 Steps involved in it

Step: 1

import javautilArrayList import javautilList import javautilScanner class Media private int id private String title private int year private boolean available public Mediaint id String title int year ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

C++ Primer Plus

Authors: Stephen Prata

6th Edition

978-0321776402, 0321776402

More Books

Students also viewed these Programming questions