Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create an Java abstract class that encapsulates a RentalItem in a RedBox rental machine. The rental item has four data members: title, year of release,

Create an Java abstract class that encapsulates a RentalItem in a RedBox rental machine. The rental item has four data members: title, year of release, slot in vending machine, and quantity available. Include an abstract method that computes and returns the rental fee, with a parameter for the number of days the items was rented.

Include an extra method(s) in the rental item class to increment and/or decrement the quantity available when items are returned and/or rented.

Create two subclasses for the rental item class:

A VideoGame class that has an additional data member for the game console (XBOX, PS4).

The rental rate is the same for each console: $3.00 per day.

A Movie class that has one attribute that indicates whether the move is on a standard DVD or on BluRay. The rental rate is $2.00 per day for BluRay and $1.75 per day for standard DVD.

Include the usual constructors, accessors, mutators, toString, copy and equals methods for all of the classes, except where not allowed. The equals method has Object as the parameter. Include the standard Java comments before each method.

Write a Java program that uses the code below to populate an array of RentalItems (represents the items in the RedBox Machine) and then interacts with the user so that items may be rented or returned. Do not change the code given. The user will type in the slot number of the item to be rented or returned. Use the console for I/O.

With each rental or return the number of items available is updated in the array.

When an item is rented the rental rate is displayed, along with the item rented.

When an item is returned, the number of days is also entered. (The days could be computed, but that added too much extra to the program.) The fee for the input number of days is displayed.

Before the program terminated, the list of all items in the array is displayed (so we/I can check the quantities available).

If the slot number the user enters is an invalid slot number, just display an illegal entry type of message.

If they user wants to rent an item, but there are none available, display an out of stock type message.

Run with various (at least one return for each type of item) rentals and returns and some illegal entry and out of stock cases.

RentalItem [] itemList = new RentalItem[9];

itemList[0] = (new VideoGame("Fallout 76", 2018, 9, 5, "XBOX"));

itemList[1] = (new VideoGame("Just Cause 4", 2018, 4, 6, "PS4"));

itemList[2] = (new Movie("First Man", 2019, 5, 7, "BluRay"));

itemList[3] = (new Movie("Goosebumps 2", 2018, 8, 8, "Standard"));

itemList[4] = (new Movie("Night School", 2018, 1, 9, "Standard"));

itemList[5] = (new Movie("Venom", 2018, 3, 10, "BluRay"));

itemList[6] = (new Movie("Black Panther", 2018, 6, 2, "BluRay"));

itemList[7] = (new VideoGame("Residen Evil 2", 2018, 7, 4, "PS4"));

itemList[8] = (new VideoGame("Maddden NFL 19", 2018, 2, 0, "XBOX"));

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

Professional IPhone And IPad Database Application Programming

Authors: Patrick Alessi

1st Edition

0470636173, 978-0470636176

Students also viewed these Databases questions