Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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]]
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Oracle8I Building Efficient Databases

Authors: Jonathan Lewis

1st Edition

0201715848, 978-0201715842

More Books

Students also viewed these Databases questions