Question: 1 . 3 8 Variables, input, and casting ( Java ) ( 1 ) Prompt the user to input an integer, a double, a character,
Variables, input, and casting Java
Prompt the user to input an integer, a double, a character, and a string, storing each into separate variables. Then, output those four
values on a single line separated by a space. Submit for points
Enter integer:
Enter double:
Enter character:
Enter string: Howdy
z Howdy
Extend to also output in reverse. Submit for point, so points total
Enter integer:
Enter double:
Enter character:
Enter string: Howdy
z Howdy
Howdy z
Extend to cast the double to an integer, and output that integer. Submit for points, so points total
Enter integer:
Enter double:
Enter character:
Enter string: Howdy
z Howdy
Howdy z
cast to an integer is
import java.util.Scanner;
public class BasicInput
public static void mainString args
Scanner scnr new Scanner
System.in;
int userInt ;
double userDouble ;
FIXME Define char and string variables similarly
System.out.printlnEnter integer: ;
userInt scnr nextInt ;
FIXME : Finish reading other items into variables, then output the four values on a single line
FIXME : Output the four values in reverse
Run your program as often as you'd like, before submitting for grading. Below, type any needed
input values in the first box, then click Run program and observe the program's output in the
second box.
Enter program input optional
If your code requires input values, provide them here.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
