You\'re thinking about going with your friends to a movie. Write a Java method s
ID: 645435 • Letter: Y
Question
You're thinking about going with your friends to a movie. Write a Java method seeMovie that accepts two parameters: the cost of a ticket in dollars, and the number of stars the movie received out of 5. The method should print console output about how interested you are; print either very interested, sort-of interested, or not interested, based on the following criteria:
You like bargains. Any movie that costs less than $5.00 is one that you want to see very much.
You dislike expensive movies. You are not interested in seeing any movie that costs $12.00 or more, unless it got 5 stars (and even then, you are only sort-of interested).
You like quality. You are very interested in seeing 5 star movies that cost under $12.00.
You are sort-of interested in seeing movies costing between $5.00 - $11.99 that also got between 2-4 stars inclusive.
You are not interested in seeing any other movies not described previously.
I have this but it's not working:
public void seeMovie(double costTicket, int movieRating)
{
if(costTicket < 5.00)
{
System.out.println("Intrested");
}
else
if(costTicket >= 12.0 && movieRating < 5)
{
System.out.println("Not Intrested");
}
else
if(costTicket >= 12.0 && movieRating == 5)
{
System.out.println("sort-of Intrested");
}
else
if(costTicket < 12.0 && movieRating == 5)
{
System.out.println("Intrested");
}
else
if(costTicket < 11.99 && costTicket < 5.00 && movieRating >2 && movieRating <4)
{
System.out.println("sort-of Intrested");
}
else
System.out.println("not Intrested");
}
}}
Explanation / Answer
Write a Java method seeMovie that accepts two parameters: the cost of a ticket in dollars, and the number of stars the movie received out of 5.
public void seeMovie(double costTicket, int movieRating)
{
if(costTicket < 5.00)
{
System.out.println("Intrested");
}
else
if(costTicket >= 12.0 && movieRating <5 )
{
System.out.println("Not Intrested");
}
else
if(costTicket >= 12.0 && movieRating == 5)
{
System.out.println("sort-of Intrested");
}
else
if(costTicket < 12.0 && movieRating == 5)
{
System.out.println("Intrested");
}
else
if(costTicket < 11.99 && costTicket > 5.00 && movieRating >2 && movieRating <4)
{
System.out.println("sort-of Intrested");
}
else
System.out.println("not Intrested");
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.