Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implement the class Media, which stores information about rentable media. Derive Video which is subclass of Media . The Media class represents the media which

  1. Implement the class Media, which stores information about rentable media.
  2. Derive Video which is subclass of Media.

The Media class represents the media which is rented.

class will need to implement the following:

  • public Media(String name, int year) a constructor which initializes the media with the provided name and publication year.
  • public String getName() retrieves the stored name of the media.
  • public int getYear() retrieves the stored year of the media.
  • @Override public boolean equals(Object other) indicates whether this media is the other media which is passed in as a parameter.
  • @Override public int hashCode() one of Java's unenforced requirements is that if we ever override an equals method, we must also override hashCode such that if two object are equal, they also have the same hash code. It is sufficent for this method to return getName().hashCode().
  • @Override public String toString() displays information about the media as a string, in the format "NAME (YEAR)".The Imitation Game (2014)

Video Task: public class Video extends Media.

This class should provide the following:

  • public static final int DVD = 0;
  • public static final int BLURAY = 1;
  • public Video(String name, int year, int runtime, String rating, int format) a constructor which initializes the movie with the provided name, publication year, runtime in minutes, rating, and format (DVD or BLURAY).
  • public int getRuntime() retrieves the stored runtime.
  • public String getRating() retrieves the stored rating.
  • public int getFormat() retrieves the stored disc format.
  • @Override public String toString() displays information about the video as a string, in the format "NAME (YEAR) FORMAT [RATING, RUNTIME min]". Print the format as either DVD or BLURAY. For example:

    The Imitation Game (2014) DVD [PG-13, 114 min]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Database Design Application Development And Administration

Authors: Mannino Michael

5th Edition

0983332401, 978-0983332404

More Books

Students also viewed these Databases questions

Question

State the uses of job description.

Answered: 1 week ago

Question

Explain in detail the different methods of performance appraisal .

Answered: 1 week ago

Question

Evaluating Group Performance?

Answered: 1 week ago