Inheritance, Polymorphism, ArrayLists, Throwing Exceptions The UML diagram below shows a set of classes designed to represent a music collection from 1995. The constructors and methods all function in the standard way, except: The equipmentRequired method should return “Record Player” or “CD Player” as appropriate. The getAlbum method of the NinetiesMusicCollection class accepts an index and returns the corresponding Album object. This method throws an IllegalArgumentException if the index is out of range. (This is the only exception you have to throw anywhere in your code.) In the NinetiesMusicCollection constructor, you can assume the ArrayList object passed as an argument is not null . Don’t worry about privacy leaks. Implement this set of classes in Java. Note the italics on the Class name “Album” and the method name “equipmentRequired” in the Album class
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Inheritance, Polymorphism, ArrayLists, Throwing Exceptions
The UML diagram below shows a set of classes designed to represent a music collection from 1995. The constructors and methods all function in the standard way, except:
The equipmentRequired method should return “Record Player” or “CD Player” as appropriate.
The getAlbum method of the NinetiesMusicCollection class accepts an index and returns the corresponding Album object. This method throws an IllegalArgumentException if the index is out of range. (This is the only exception you have to throw anywhere in your code.)
In the NinetiesMusicCollection constructor, you can assume the ArrayList<Album> object passed as an argument is not null . Don’t worry about privacy leaks.
Implement this set of classes in Java.
Note the italics on the Class name “Album” and the method name “equipmentRequired” in the Album class.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps