Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Background information

For this assignment you need to write a console application in the Java programming language which implements a simulation for a movie borrowing and return system for the video store MovieMaster. The staff at MovieMaster will need to be able to maintain the details for rental movies that are available to hire by registered MovieMaster customers.

Rental movies may be available in bluray and/or DVD format and are also tagged as being either new release movies (which can only be borrowed for up to 2 days before needing to be returned) or weekly movies (which can be borrowed for up to 7 days before needing to be returned).

Bluray movies cost $5.00 to hire and DVD's cost $3.00 to hire. If a rental movie in either format is returned late then a late fee of 50% of the hire fee for the relevant movie type is charged for each day that has passed after the initial loan period for the movie in question.

MovieMaster staff will need to be able to perform the following tasks:

- Displaying a summary of the details for rental movies that are currently available for hire.
- Displaying all movies within a specified genre to allow MovieMaster staff to make recommendations to customers based on the type of rental movies they are interested in.
- Record details for movies that have been borrowed by MovieMaster customers.
- Record details for movies that have been returned by MovieMaster customers.
- Displaying full details for all rental movies that are currently available for hire.

You will be addressing these requirements by implementing a RentalMovie class to encapsulate the details and functionality for a single RentalMovie that has been made with MovieMaster, as well as implementing a console application which creates a set of RentalMovie objects and simulates the functionality of the service recording and management system as described above.

Assignment Overview

In this assignment you will be developing a simple service recording and management system for MovieMaster, which is a mechanical servicing business which offers rental movies for hire.

The first stage in this task will be to develop a simple RentalMovie class which encapsulates the details for a single RentalMovie that is available for hire from the MovieMaster store.

The design and required functionality for this RentalMovie class will be described in stage 1 of this specification.

In the second stage for this task you will be required to demonstrate your understanding of core object- oriented programming concepts by showing how the RentalMovie class can be instantiated to create many RentalMovie objects and how the details contained within these RentalMovie objects can be viewed, queried and updated.

You will do this by implementing an application class which allows the user to see how some potential features of the new movie rental store management system will function - the details of the features that are required will be described in stage 2 of this specification.

Make sure you read through this specification thoroughly and understand what you are required to do before you start trying to implement this program.

Stage 1 - Implementing the RentalMovie class

You are required to implement a class named RentalMovie to model the details of rental movie that is available for hire from the MovieMaster store.

The design and functionality for this RentalMovie class will be discussed below and you must adhere to this class design / functional specification - no changes to this design are permitted unless a specific clarification or correction is made by the instructor, as part of this task is being able to understand and follow a design specification that you have been given as well as working within design constraints of a system.

a) Define private instance variables to store basic RentalMovie details:

Also define the private boolean instance variables:

isOnLoan (to record whether the RentalMovie in question is currently on loan) isBluray (indicating whether the RentaMovie is in bluray or DVD format) isNewRelease (indicating whether the RentalMovie is a new release or not.)
(Note that you should not be defining any additional instance variables for values which should be declared locally within the methods that are needed / used within.)

b) Provide a pre-defined constructor for the class.

The constructor accepts String parameters for the movie ID, movie title, and genre, as well as boolean parameters indicating whether the movie is a bluray and whether it is a new release as shown below:

public RentalMovie(String movieID, String movieTitle, String movieGenre,
boolean isBluray, boolean isNewRelease)

This constructor should initialise the corresponding instance variables with the parameter values that have been passed in - it should also initialise the borrowing history instance variable to the empty String (ie. "") and initialise the onLoan instance variable to false (reflecting that a newly added RentalMovie is available for hire).

c) Implement accessors (only)

Accessors need to be provided for the movie ID, movie title and movie genre instance variables.

d) Implement a method for getMediaType()

Implement a method public String getMediaType(), which returns the String "Bluray" if the RentalMovie is a bluray, otherwise the String "DVD" should be returned when the RentalMovie is not a bluray.

Hint: You will need to check the isBluray instance variable to determine if the RentalMovie is a bluray or not.

e) Implement a method for public double borrowMovie(String memberID)

This method allows a RentalMovie to be borrowed.

This method should start by checking to see if the RentalMovie is currently on loan - if that is the case then the value Double.NaN should be returned (this is a pre-defined constant in the Double class that you can refer to within your program).

If the RentalMovie is not currently on loan then the method should proceed to record that the RentalMovie is now on loan (by updating the isOnLoan instance variable appropriately), after which it should determine which borrowing fee applies based on the movie type being rented (ie. bluray or DVD).

Once the appropriate borrowing fee has been determined this fee should be added to the total fees for the RentalMovie and the borrowing history should be updated by appending a new entry detailing the member ID and borrowing fee that applies.

The format of this entry is shown below (assuming that the rental item in question is a bluray that has been borrowed by member ID "m963"):

- Borrowed by: m963, Borrowing Fee: $5.00

Once the borrowing history has been updated the method should return the borrowing fee that was determined previously to the caller.

(Note that "returning" means using the return keyword to send a value back to the caller of the method, not printing something out to the screen.)

f) Implement a method public double returnMovie(int daysBorrowed)

This method allows a RentalMovie to be returned.

This method should start by checking to see if the RentalMovie is not currently on loan - if that is the case then the value Double.NaN should be returned to the caller.

If the RentalMovie is currently on loan then the method should proceed to record that the RentalMovie is now available (by updating the isOnLoan instance variable appropriately), after which it should determine which rental period applies, based on whether the RentalMovie is a new release or not.

Once the appropriate loan period has been determined then the method should determine how many days the RentalMovie was returned late.

If this figure is less than or equal to zero (0) then the method should return the value zero (0) to the caller.

Otherwise the method should determine the late return fee that applies, which is calculated as 50% of the base rental fee per day late for the RentalMovie in question (you will need to check the movie type here to work out which base rental fee applies), after which the late return fee should be added to the total fees for the RentalMovie.

Once the late return fee has been calculated and added to the total fees for the RentalMovie then the borrowing history should also be updated by appending a new entry detailing how many days the RentalMovie was returned late and the corresponding late fee that applies.

The format of this entry is shown below (assuming that the rental movie in question is a bluray that was returned 3 days late):

- Returned 3 days late, Late Return Fee: $7.50 (movie returned late)

- Returned 0 days late, Late Return Fee: $0.00 (movie returned on time)

Once the borrowing history has been updated the method should return the late fee that was determined previously to the caller.

Note that "returning" means using the return keyword to send a value back to the caller of the method, not printing something out to the screen.

g) Implement a method public void displayMovieDetails()

This method displays all of the details of a RentalMovie to the screen in a neat, formatted manner - this summary should include the following details:

Sample output demonstrating the structure and content required in the final summary for a
RentalMovie is shown below:

Stage 2 - Using the RentalMovie class

In this stage you will be implementing a separate application class MovieRentalSystem that will demonstrate the creation, storage and use/manipulation of a collection of RentalMovie objects which have been instantiated from the RentalMovie class described previously in

Stage 1.
This application class should be implemented in a separate file.

This set of RentalMovie objects will be stored in an array of RentalMovie references and you will need to demonstrate how this array of RentalMovie objects can be iterated through, how specific objects can be located within the array and how these objects can be referred to or manipulated by calling methods defined previously within the RentalMovie class (as described in Stage 1) for the objects that are being stored in the array.
We will be exploring how to approach creating and managing an array of objects during the week 6 learning materials and live chat session.
In the specification for each of the requirements below you will see snapshots of particular aspects of the application's execution that are relevant to the requirement being discussed - you can refer to the sample execution runs that have been supplied in another document in the Assignment 2 folder to see how the program as a whole should run.

You should note that each of the requirements below should be implemented/executed in sequence within your main method (ie. one after another) -
menu driven program.

The description of the individual "features" you are required to implement in this application class begins below (these can all be done inside the main() method of your application class):

a) Declare and instantiate array of RentalMovie references named movies that can hold up to six (6) RentalMovie objects.

b) Create 6 RentalMovie objects with the details shown below - passing the values specified to the constructor for each object in an appropriate manner - and store each object in the next vacant position in the movies array described above.

c) Display customised (selective) data (movie ID and movie title / genre) for each of the RentalMovies stored in the movies array, as shown below in the sample screenshot:

Note: You must do this by using a loop to iterate through the movies array and then call the appropriate accessors for each object in the array in order to retrieve the required details, so that they can be printed to the screen as shown above.

It is not acceptable to create an extra method which does the printing over in the RentalMovie class and then call that method for each object here.

d) Allow the user to specify a particular genre that they wish to list rental movies for and then execute a search and display the movie ID, title and media type for all RentalMovies that belong to that particular genre, as shown below:

If no RentalMovies were found that belong to the specified genre then a suitable error message should be displayed to the screen as shown below:

e) Implement a menu-driven Movie Borrowing / Returning feature, which allows the user to record details for movies that have been borrowed and returned, as well as displaying details for all movies currently in the system as described below:

(i) Movie Borrowing / Returning System Menu

This case-insensitive menu (ie. one that accepts both the lower case and upper case versions of each valid menu selection) should provide options to borrow a RentalMovie, return a RentalMovie , display all movie details and exit the menu.

This menu feature should continue to display the available options and prompt the user to enter their selection until they choose the "Exit" option and the menu should display a suitable error message when the user enters an invalid selection - the basic appearance and error handling functionality of this menu is demonstrated in the screenshot on the next page:

(ii) Borrow Movie Feature

The "Borrow Movie" feature should start off by prompting the user to enter the movie ID of the RentalMovie that is being borrowed, after which it should search for a matching RentalMovie object in the movies array.

If a RentalMovie object with the specified movie ID was not found in the movies array then a suitable error message should be displayed to the screen, otherwise if a RentalMovie with the specified movie ID was found in the movies array, then the program should proceed to prompt the user to enter the member ID of the customer who is borrowing the movie.

From there this feature should attempt to call the borrowMovie() method for the RentalMovie object that was located earlier, check the result it returns and display a message indicating whether the attempt to borrow the movie was successful or not.

Note that to check for the error signal that might be returned (Double.NaN) the program will need to use the method Double.isNaN() to work out if the returned value is indeed the error signal - using the simpe equality (‘==') operator will not work.

An example showing how to achieve this is shown below:

double result = someMethod();
if (Double.isNaN(result) == true)
{
System.out.println("The method returned an error!");

(iii) Return Movie Feature

The "Return Movie" feature should start off by prompting the user to enter the movie ID of the RentalMovie to be returned, after which it should search for a matching RentalMovie object in the movies array.

If a RentalMovie object with the specified movie ID was not found in the movies array then a suitable error message should be displayed to the screen, otherwise if a RentalMovie with the specified movie ID was found in the movies array then the program should proceed to prompt the user to enter the days borrowed.

From there this feature should attempt to call the returnMovie() method for the RentalMovie object that was located earlier, check the result it returns and display a message indicating whether the attempt to return the movie was successful or not.

(iv) Display All Movie Details feature

This feature should print details for all of the RentalMovie objects in the system by using a loop to iterate (step) through the movies array and invoking (calling) the displayMovieDetails() method for each RentalMovie object in turn.
A screenshot showing how the output might look is shown below:

Coding Style

Your program should demonstrate appropriate coding style, which includes:

- Levels of 3 or 4 spaces used to indent rather than tabs - you can set up your IDE/editor to automatically replace tabs with levels of 3 or 4 spaces.
- Indentation levels used are consistent throughout program
- A new level of indentation added for each new class/method/ control structure used
- Going back to the previous level of indentation at the end of a class/method/control structure (before the closing brace if one is being used)
- Lines of code not exceeding 80 characters in length - lines which will exceed this limit are split into two or more segments where required (this is a guideline - it's ok to stray beyond this by a small amount occasionally, but try to avoid doing so by more than 5-6 characters or doing so on a consistent basis).
- Expressions are well spaced out and source is spaced out into logically related segments
- Use of appropriate identifiers wherever possible to improve code readability
- Use of comments to describe the purpose of each data class, each method within a data class and any non-trivial segments of code within those methods.
An example of a good comment:
/* calculate the total value of the room rental
* prior to applying surcharge.*/
int standardRate = 200;
int numberOfNights = 4;
int totalBeforeSurcharge = standardRate * numberOfNights;

An example of a bad comment:
// declare an int value for storing the basic nightly rate for a room
int standardRoomRate = 200;

// declare and assign an initial account balance.
double x = 500.0;

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92061285

Have any Question?


Related Questions in Computer Engineering

You are required to carry out an analysis of the it

You are required to carry out an analysis of the IT requirements of a software company and design a virtualisation solution to satisfy these requirements. You will need to produce a report outlining your design and provi ...

In the spring of 2015 three utility companies in the

In the Spring of 2015, three utility companies in the Ukraine received email purporting to come from Ukraine's parliament, the Rada. It was addressed to employees that were used to receiving communications from the Rada ...

Represent the number obtained by the last you have digits

Represent the number obtained by the last you have digits of your student number in binary, e.g., if your student number is XXX8372 then the question is to represent "8372" in binary. Also, represent the first three digi ...

Describe a ping of death attack as an attack that causes

Describe a ping of death attack as an attack that causes the victim computer to freeze and malfunction.

Submit your solution as a plain-text file with a c

Submit your solution as a plain-text file with a .c extension in the name. Name timer - counts down to zero from a user supplied number. Description Displays a count down to zero from a number supplied by the user at the ...

Taskwrite an essay according to the following

Task Write an essay according to the following instructions. Your lecturer will provide few links for relevant articles and/or case studies. These will be available to you just after your second assignment submission dat ...

Heights of women follow a normal distribution with

Heights of women follow a normal distribution with mean μ=63.6 inches and standard deviation of σ=2.5 inches.  Suppose random samples of 10 women are chosen and their mean height calculated. Please calculate the mean and ...

We might consider a regression of the number of group

We might consider a regression of the number of group members and the efficiency of project completion. Which of those would be the dependent and which would be the independent variables?

The pressure of 50 l of an ideal gasin a flexible container

The pressure of 5.0 L of an ideal gasin a flexible container is decreased to one-forth of its original pressure, and itsabsolute temperature is decreased to one-forth of the original. What is the finalvolume of the gas?

Identify at least two 2 factors that have led to the

Identify at least two (2) factors that have led to the explosive growth of digital crime over the past a few decades. Next, describe the most common forms of digital crime, and give your opinion as to why those forms you ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As