Write a complete Java program that prompts the user for a number and prints back the integer as well as floating point values to the console.

What will be an ideal response?

```
import java.util.Scanner;
public class WrapperDemo
{
public static void main(String args[])
{
Scanner keyboard = new Scanner(System.in);
System.out.print("Enter any number >> ");
String strNumber = keyboard.next();
int intNumber = Integer.parseInt(strNumber);
double dblNumber = Double.parseDouble(strNumber);

System.out.println("The integer value of " + strNumber + " is: " +
intNumber);
System.out.println("The floating-point value of " + strNumber + " is: " +
dblNumber);
}
}
```

Computer Science & Information Technology

You might also like to view...

Which of the following is NOT a type of logic calculation?

A) OR B) BUT C) AND D) NOT

Computer Science & Information Technology

If a member function of a class already provides all or part of the functionality required by a constructor or another member function then:

a. Copy and paste that member function’s code into this constructor or member function. b. Call that member function from this constructor or member function. c. That member function is unnecessary. d. This constructor or member function is unnecessary.

Computer Science & Information Technology