Question: 2.31 LAB: Warm up: Variables, input, and casting (1) Prompt the user to input an integer, a double, a character, and a string, storing

2.31 LAB: Warm up: Variables, input, and casting (1) Prompt the userto input an integer, a double, a character, and a string, storingeach into separate variables. Then, output those four values on a singleline separated by a space. (2 pts) Note: This zyLab outputs a

2.31 LAB: Warm up: Variables, input, and casting (1) 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. (2 pts) Note: This zyLab outputs a newline after each user-input prompt. For convenience in the examples below, the user's input value is shown on the next line, but such values don't actually appear as output when the program runs. Use next() to read String, not nextLine(). Enter integer: 99 Enter double: 3.77 Enter character: Z Enter string: Howdy 99 3.77 z Howdy (2) Extend to also output in reverse. (1 pt) Enter integer: 99 Enter double: 3.77 Enter character: Z Enter string: Howdy 99 3.77 z Howdy Howdy z 3.77 99 (3) Extend to cast the double to an integer, and output that integer. (2 pts) Enter integer: 99 Enter double: 3.77 Enter character: Z Enter string: Howdy 99 3.77 z Howdy Howdy z 3 77 (3) Extend to cast the double to an integer, and output that integer. (2 pts) Enter integer: 99 Enter double: 3.77 Enter character: Z Enter string: Howdy 99 3.77 z Howdy Howdy z 3.77 99 3.77 cast to an integer is 3 LAB ACTIVITY 2.31.1: LAB: Warm up: Variables, input, and casting 0/5 BasicInput.java Load default template... 1 import java.util.Scanner; 2 3 public class Basic Input { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int userInt; double userDouble; // FIXME Define char and string variables similarly System.out.println("Enter integer: "); userInt = scnr.nextInt(); 4 5 6 7 8 9 10 11 12 13 14 15 // FIXME (2): Output the four values in reverse 16 17 // FIXME (3): Cast the double to an integer, and output that integer 18 // FIXME (1): Finish reading other items into variables, then output the four values on a single line separat Develop mode Submit mode 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.

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 Algorithms Questions!