Answered step by step
Verified Expert Solution
Link Copied!

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 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

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 Technology And Management Computers And Information Processing Systems For Business

Authors: Robert C. Goldstein

1st Edition

0471887374, 978-0471887379

More Books

Students also viewed these Databases questions

Question

For model (5.1), show that (x)/x = (x)[1 (x)].

Answered: 1 week ago