Practice with inheritance, polymorphism and interface in Java Problem to solve

SuperClass
 (Not rated)
 (Not rated)
Chat

Assignment 5 Purpose: Practice with inheritance, polymorphism and interface in Java Problem to solve: Re-implement Assignment3 in Java. However, DVD class now implements Playable interface while Book and Journal class implements Openable interface. Assume you have to write software to be used by a university library. There are three types of item that can be borrowed from the library – DVDs, books and journals. These are all a type of Media. You will need to create a simple hierarchy for items that the library lends out. Create a Media super class with DVD, Book and Journal as sub classes, also implements either Openable or Playable interface as shown in the UML diagram. Media id (int) title (string) year (int) changeID(newID:int) : void print() : void interface interface Playable play() : void stop() : void Openable open() : void close() : void DVD director (string) print() : void Book author (string) numPages (int) print() : void Journal volume (int) number (int) print() : void Requirements: The member variables (id, title, year) in the Media class should be private. Each class should have appropriate constructor(s). Display Name and student ID of team members when the program first started like in the example. Here is the implementation of the class Assignment5. public class Assignment5 { public static void main(String[] args) { displayInfo(); Media[] mediaArray = new Media[10]; mediaArray[0] = new DVD(352, "Remember The Alamo", 1945, "George Smith"); mediaArray[1] = new DVD(831, "High School Blues", 1984); mediaArray[2] = new DVD(194, "Going For The Touchdown", 1984, "Frank Madden"); mediaArray[3] = new DVD(576, "Martian Hairdresser", 1992, "Debbie Gold"); mediaArray[4] = new Book(608,"How to Make Money", 1987, "Phil Barton", 324); mediaArray[5] =...

    • 10 years ago
    Practice with inheritance, polymorphism and interface in Java Problem to solve
    NOT RATED

    Purchase the answer to view it

    • practice_with_inheritance_polymorphism_and_interface_in_java_problem_to_solve.docx