Question: Problem Description Skills required for this program: user input, type casting In this assignment you will be reading a double as user input, casting this

Problem Description
Skills required for this program: user input, type casting
In this assignment you will be reading a double as user input, casting this double to an integer, and printing the integer. As you have learned in class, while a double can store decimals, an integer cannot. Effectively, by casting from a double to an integer, you are removing the decimal point from the number.
You will first need to create a class named Program2. Within this class, you will read a double entered by the user as input. You should then cast this double to an integer. Finally, you should output the integer.
As usual, this line should terminate in a new line. To further your understanding of these requirements, refer to the sample test cases below.
Submit your program Program2. java to Gradescope. Make sure there are no packages at the top of your program. If there are, delete or comment them out.
Sample Test Cases
You can test your program by copying an entire input sample and pasting it into the console. If the output does not exactly match the example output, there is an error in your code.
\table[[Input,Output],[12.5,12],[-18.55,-18],[45.0,45],[.5,0],[70,70]]
 Problem Description Skills required for this program: user input, type casting

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!