Question: 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 Film(String 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;
addFilm(String 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;
searchFilmByTitle(String 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!