2.5.8: Movie Ratings 1 public class MovieRatings extends ConsoleProgram 2- { public void run() { 3. 4 } 6 } 5


use java


2.5.8: Movie Ratings<br>1 public class MovieRatings extends ConsoleProgram<br>2- {<br>public void run() {<br>3.<br>4<br>}<br>6 }<br>5<br>

Extracted text: 2.5.8: Movie Ratings 1 public class MovieRatings extends ConsoleProgram 2- { public void run() { 3. 4 } 6 } 5
Movies always come with ratings. A bad movie may have 1.4 stars, and a great<br>movie may have 4.9 stars.<br>Your job is to write a program that gets a movie rating from the user as a<br>double, and then rounds to the nearest int using the rounding with casting<br>technique.<br>For example, a run of your program may look like this:<br>Please enter a movie rating: 3.4<br>Rating rounded: 3<br>Another run may look like this:<br>Please enter a movie rating: 3.7<br>Rating rounded: 4<br>If the user inputs a value with a decimal place of .5 or greater, you should<br>round up:<br>Please enter a movie rating: 3.5<br>Rating rounded: 4<br>HINT:<br>To see how you can use casting to round double values to the nearest int<br>value, refer to the previous example Rounding using Casting.<br>

Extracted text: Movies always come with ratings. A bad movie may have 1.4 stars, and a great movie may have 4.9 stars. Your job is to write a program that gets a movie rating from the user as a double, and then rounds to the nearest int using the rounding with casting technique. For example, a run of your program may look like this: Please enter a movie rating: 3.4 Rating rounded: 3 Another run may look like this: Please enter a movie rating: 3.7 Rating rounded: 4 If the user inputs a value with a decimal place of .5 or greater, you should round up: Please enter a movie rating: 3.5 Rating rounded: 4 HINT: To see how you can use casting to round double values to the nearest int value, refer to the previous example Rounding using Casting.

Jun 01, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions ยป

Submit New Assignment

Copy and Paste Your Assignment Here