Lab 2: Movie Critic
Web-CAT: Submit Java programs to this automated grading platform.
Task Outline
- Due Date: Friday, September 20, 2019
- Total Points: 10
- In this lab, you must write a
Javaprogram that determines the user's interest in seeing a particular movie.
Background Theory
- You interest in a movie depends upon the following two factors:
- The
priceof the movie's ticket, in dollars. - The
ratingwhich the movie received, which can be any decimal number from 0 to 5, inclusive.
- The
- Your level of interest in a movie is shown by the following indicators:
extremely interestedvery interestedmoderately interestedbarely interestedcompletely uninterested
- The following are the criteria upon which you make your movie viewing decisions. Hint:
Implement these in
Javausing anif-else if-elsecode structure.- You like bargains. Any movie that costs less than $5.00 is one that you are
extremely interestedin viewing, as long as that movie has received 2 or more stars. - You dislike expensive movies. If a movie costs $12.00 or more, then you are
completely uninterestedin seeing it. However, if that movie happened to recieve 5 stars, then you arebarely interestedin seeing it. - You enjoy high quality movies. You are
very interestedin seeing any movie that has a price below $12.00, and is rated greater than 4 stars. - You are
moderately interestedin seeing any movie which costs between $5.00 and $11.99, as long as those movies received between 2 and 4 stars, inclusive. - You dislike poorly rated movies. Any movie that has received less than 2 stars is one that you are
barely interestedin seeing, as long as it costs less than $5.00. - If any movie falls outside of the previously mentioned criteria, then you are
completely uninterestedin seeing it.
- You like bargains. Any movie that costs less than $5.00 is one that you are
- Note that the function
selectFilm()returns the variableoutcome. You must assign the corresponding interest String to the variableoutcome, before it is returned.
Code Distribution
| Description | File Size | File Name |
|---|---|---|
Java Source Code for Movie Critic |
4.8KB | lab02.zip |
Contents of lab02.zip:
Lab02MovieCritic/
├── MovieCritic.class
├── MovieCritic.ctxt
├── MovieCritic.java
├── MovieCriticJUnitTest.class
├── MovieCriticJUnitTest.ctxt
├── MovieCriticJUnitTest.java
├── package.bluej
└── README.TXT
Specification
- Write a
Javaprogram in the fileMovieCritic.javathat produces an output which corresponds to your particular interest in a certain movie. - You will write your solution in a function called
selectFilm(double price, double rating)right below the place where it says:YOUR CODE HERE - When the function call
selectFilm(6.5, 3,5)is executed, the output of the program should be:moderately interested
Testing
- Click on the Run Tests button to execute the
JUnittest bench.JUnitindicates a successful test with a green bar, and an unsuccessful test with a red bar.
Submission
- Upload the file
MovieCritic.javato the Web-CAT automated grading platform.