CompSci 251: Intermediate Computer Programming Lab 3 2019
Create a Movie class conforming to the diagram above. Things to do
Declare you instance variables at the top of the class.
Write a specifying constructor. No default constructor is required.
Write getName and setName. There are no restrictions on the setting the name.
Write getMinutes and setMinutes. When setting minutes, it is not allowed to be negative.
Write getTomatoScore and setTomatoScore. When setting tomato score, score is not allowed
to be negative or over 100.
Write isFresh. A score is considered fresh if it is 60 or above. It is rotten otherwise.
Write display. Print out the name, the total minutes, and if the movie is Fresh or Rotten.
Remember, you have method which tells you this now.
The driver is mostly complete. I placed one TODO, add a new movie of your choice to the array
that stores movies (called myCollection) in the driver.
Your output should match the output below plus the one movie you add to it. Pay attention to how objects are accessed in the driver. See your TA when your output is correct.
Output:
Here are all the movies in my collection of movies.
Movie: Batman The Dark Knight
Length: 152 min.
TomatoScore: Fresh
Movie: Guardians of the Galaxy
Length: 125 min.
TomatoScore: Fresh
Movie: The GodFather
Length: 178 min.
TomatoScore: Fresh
Movie: Suicide Squad
Length: 137 min.
TomatoScore: Rotten
//The movie you add will print out here. _______________________________________________
Here are the Fresh movies.
Batman The Dark Knight is fresh.
Guardians of the Galaxy is fresh.
The GodFather is fresh.
Here are the Rotten movies.
Suicide Squad is rotten.
//The movie you add will print out here, its score will determine if fresh or not. _______________________________________________
The movie Harry Potter and the Prisoner of Azkaban was created.
Is Harry Potter and the Prisoner of Azkaban a long movie? Yes, it is a bit long.
Can I set the minutes of Harry Potter and the Prisoner of Azkaban to a negative number?
It did NOT work. Negative runtimes are not allowed.
Can I set tomato score of Harry Potter and the Prisoner of Azkaban to a negative number?
It did NOT work. Negative scores are not allowed.
Can I set tomato score of Harry Potter and the Prisoner of Azkaban to a number greater than 100?
It did NOT work. Still the best Harry Potter movie out all the movies though.
Reviews
There are no reviews yet.