Question: Add the line that will allow the user to enter name. import java.util.Scanner; public class Method3 { public static void main (String [] args) {
Add the line that will allow the user to enter name.
import java.util.Scanner; public class Method3 { public static void main (String [] args) {
String name; int num; double score; Scanner sc = new Scanner(System.in); System.out.print("Enter a number from 1 to 10: "); num = sc.nextInt(); System.out.print("Enter your full name: " ); name = sc.nextLine(); System.out.print("Enter a score from 10 to 20: "); score = sc.nextDouble(); System.out.print("The number you entered is: " + num + ". " + "Your name is: " + name + " and your score is: " + score); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
