Complete the class Movie

This commit is contained in:
2026-04-26 15:38:25 +03:30
parent ad601cadc2
commit 6f8c0d8f7e
2 changed files with 45 additions and 7 deletions
+44 -4
View File
@@ -6,7 +6,8 @@ import java.util.List;
* Model class representing a movie * Model class representing a movie
* Fields: id, title, genres, images * Fields: id, title, genres, images
*/ */
public class Movie { public class Movie
{
private Long id; private Long id;
private String title; private String title;
@@ -16,9 +17,48 @@ public class Movie {
private String imdbRating; private String imdbRating;
private String country; private String country;
// TODO: Create a constructor with all fields public Movie(Long id, String title, List<Genre> genres, String images, String year, String imdbRating, String country)
{
this.id = id;
this.title = title;
this.genres = genres;
this.images = images;
this.year = year;
this.imdbRating = imdbRating;
this.country = country;
}
// TODO: Create a simple constructor with id and title only public Movie(Long id, String title)
{
this.id = id;
this.title = title;
}
// TODO: Create getters and setters for all fields public Long getId() { return id; }
public void setId(Long id) { this.id = id; }
public String getTitle() { return title; }
public void setTitle(String title) { this.title = title; }
public List<Genre> getGenres() { return genres; }
public void setGenres(List<Genre> genres) { this.genres = genres; }
public String getImages() { return images; }
public void setImages(String images) { this.images = images; }
public String getYear() { return year; }
public void setYear(String year) { this.year = year; }
public String getImdbRating() { return imdbRating; }
public void setImdbRating(String imdbRating) { this.imdbRating = imdbRating; }
public String getCountry() { return country; }
public void setCountry(String country) { this.country = country; }
} }
+1 -3
View File
@@ -102,10 +102,8 @@ public class MovieService {
* PUT ALL PARSING CODE INSIDE try-catch * PUT ALL PARSING CODE INSIDE try-catch
*/ */
public void displayMoviesByGenre(Long genreId, Long page) { public void displayMoviesByGenre(Long genreId, Long page) {
// TODO: Write your code here
// All parsing code must be inside try-catch
try { try {
// Your code here
} catch (Exception e) { } catch (Exception e) {
System.err.println("ERROR: " + e.getMessage()); System.err.println("ERROR: " + e.getMessage());