subject

In Java please.
Write a code that prompts 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. The output to be look like:
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
1. Below is the code that is giving error, please provide the correct code for above requirement.
import java. util. Scanner;
public class BasicInput {
public static void main(String[] args) {
Scanner scnr = new Scanner(System. in);
int userInt = 0;
double userDouble = 0.0;
// FIXME Define char and string variables similarly
String randomcharacter = " ";
String enterstring = " ";
Character randomc = ' ';
System. out. println("Enter integer: ");
userInt = scnr. nextInt();
System. out. println("Enter double: ");
userDouble = scnr. nextDouble();
System. out. println("Enter character: ");
randomcharacter = scnr. nextLine();
randomc = randomcharacter. charAt(0);
System. out. println("Enter string: ");
enterstring = scnr. next();
System. out. println(userInt + " " + userDouble + " " + randomc + " " + enterstring);
System. out. println(enterstring + " " + randomc + " " + userDouble + " " + userInt);

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:30
What can tanya do now to start preparing for the college and scholarship application process? think about her grades, activities in which she can get involved, possible part-time jobs at which she can work, and standardized tests she can take. (10 points) apex
Answers: 2
question
Computers and Technology, 24.06.2019 14:00
Which describes careers that have similar education requirements but different qualifications? product safety engineers and materials engineers industrial safety engineers and industrial health engineers quality control systems managers and inspectors industrial safety and health engineers and hand packers
Answers: 3
question
Computers and Technology, 25.06.2019 04:10
This might be a bit off-topic, but i'm having trouble with a certain arg made by game theory. if there are any theorists out there that wanna , it would be appreciated!
Answers: 2
question
Computers and Technology, 25.06.2019 06:10
In your pest busters game, how does player 2 move the ship_2 object? a pressing the w and s keys b. pressing the up arrow and down arrow keys c. moving the mouse from side to side d. moving the mouse up and down select the best answer from the choices provided
Answers: 3
You know the right answer?
In Java please.
Write a code that prompts the user to input an integer, a double, a character,...
Questions
question
English, 16.12.2020 05:50
question
History, 16.12.2020 05:50
question
Health, 16.12.2020 05:50
Questions on the website: 13722367