Java Bootcamp – Workbooks and Challenges
)}
The World of Objects (Challenge)

Part 1

From the Java Bootcamp Resources, launch Part 1.

1.png

Task 1

Add the following fields to the Movie class.

private String name; private String format; private double rating;

Then create a constructor, copy constructor, getters, and setters.

Task 2

Create a toString method that returns the following String.

return this.rating + "\t" + this.format + "\t\t" + this.name + "";

Task 3

Populate the array inside main() with the following Movie objects.

new Movie("The Shawshank Redemption", "BlueRay", 9.2), new Movie("The Godfather", "BlueRay", 9.1), new Movie("The Godfather: Part II", "DVD", 9.0), new Movie("The Dark Knight", "BlueRay", 9.0), new Movie("Schindler's List", "DVD", 8.9), new Movie("The Lord of the Rings: The Return of the King", "BlueRay", 8.9), new Movie("Pulp Fiction", "DVD", 8.8), new Movie("The Lord of the Rings: The Fellowship of the Ring", "DVD", 8.8)

Final Output

********************************MOVIE STORE******************************* 9.2 BlueRay The Shawshank Redemption 9.1 BlueRay The Godfather 9.0 DVD The Godfather: Part II 9.0 BlueRay The Dark Knight 8.9 DVD Schindlers List 8.9 BlueRay The Lord of the Rings: The Return of the King 8.8 DVD Pulp Fiction 8.8 DVD The Lord of the Rings: The Fellowship of the Ring

Associated Course: The Complete Java Development Bootcamp
Related Course: The Complete Spring Boot Development Bootcamp – Become a Java Web Developer

Feedback Summary
4.7
43 students
5

91%
4

2%
3

0%
2

0%
1

7%
Written Reviews
There are no written reviews yet.