Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Project Description: In this project, you must implement a public DigitalLibrary class that simulates a digital movie library. A DigitalLibrary object stores data about movies
Project Description: In this project, you must implement a public DigitalLibrary class that simulates a digital movie library. A DigitalLibrary object stores data about movies in an ArrayList of custom Film objects. The Film class is shown below and includes attributes such as title, cost, and year of release. You will create methods within the library class to add films, search by title, find the most expensive film, and find the oldest film.
public class Film
private String title;
private double cost;
private int year;
Constructor to initialize the Film object
public FilmString title, double cost, int year
this.title title;
this.cost cost;
this.year year;
Getter for the title
public String getTitle
return title;
Getter for the cost
public double getCost
return cost;
Getter for the year
public int getYear
return year;
Override toString method to print film details easily
@Override
public String toString
return Title: title Cost: $ cost Year: year ;
Requirements:
DigitalLibrary Class:
Private Attributes:
ArrayList films an array list that stores the film objects;
Constructor:
Initialize the films ArrayList as empty;
Public Methods:
getFilms: Returns films;
addFilmString title, double cost, int year: Appends a new film to the films;
findMostExpensiveFilm: Returns the film with the highest cost;
findOldestFilm: Returns the oldest film based on the year;
searchFilmByTitleString title: Returns a film by its title. If no film is found, return null.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started