Use the following below to answer questions1 & 2: import java.util.Scanner; publ
ID: 3614005 • Letter: U
Question
Use the following below to answer questions1 & 2:import java.util.Scanner;
public class Lab3_Ex1
{
public static void main (String [] args)
{
Scanner keyboard = new Scanner(System.in);
float x;
int y;
char ch1, ch2;
String name;
String input;
System.out.print( "Enter a character: ");
input = keyboard.next();
ch1 = input.charAt(0);
System.out.print( "Enter a number: ");
y = keyboard.nextInt();
System.out.print( "Enter another character:");
input = keyboard.next();
ch2 = input.charAt(0);
System.out.print( "Enter a name:"); name = keyboard.next();
System.out.print( "Enter a floating point value:");
x = keyboard.nextFloat();
System.out.println(" ch1 = " + ch1);
System.out.println( "y = " + y);
System.out.println( "ch2 = " + ch2);
System.out.println( "Name is " + name);
System.out.println( "x = " + x);
System.exit(0);
}
}
Run the above program using the following sets of data and answerthe
questions below. Type your answers into a text file, name thefile
“Lab3_Ex1_output” and upload the file to ELearning.
1. Enter x 1234 y john 10.50
press the enter key
Why did all the prompts after the first one run together and notstop for you
to enter data?
2. Enter 1 89 j 110.50
press the enter key
What is the computer waiting for?
Enter a 1, then explain why the data is the way it is.
Explanation / Answer
hello... 1) This is because we entered everthing what is asked. Theprogram ask the user to enter two character, a name, a number, anda floating number, and we entered every thing. 2) The computer is waiting for you to enter a floatingnumber. this is because we did not completely inputed all ofthe questions. After inputing the last question, thecompiler will show the out put. This is because the program iswritten in that way. Thank YouRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.