Question: Explain why doesnt the following source code work properly and write the solution to fix the issue. (20 Points) import java.util.Scanner; public class About {
Explain why doesnt the following source code work properly and write the solution to fix the issue. (20 Points)
import java.util.Scanner;
public class About
{
public static void main(String[] args)
{
String name;
int height;
double income;
Scanner keyboard = new Scanner(System.in);
System.out.print(What is your height? );
height = keyboard.nextInt();
System.out.print(What is your annual income? );
income = keyboard.nextDouble();
System.out.print(What is your name? );
name = keyboard.nextLine();
System.out.println(Hello, + name . Your height is + height + and your income is $ + income);
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
