Make a program that will use the scanner and will output strings, int and double
ENTER FULLNAME
ENTER ADRESS
ENTER STATUS
ENTER SCHOOL NAME
ENTER FIRST NUMBER
ENTER FIFTH NUMBER
ENTER FIRST DECIMAL NUMBER
ENTER FIFTH DECIMAL NUMBER
import java.util.Scanner;
public class Program {
public static void main(String[]args) {
Scanner scanner = new Scanner(System.in);
String fullName;
System.out.print("ENTER FULLNAME\n");
fullName = scanner.nextLine();
System.out.println("FULLNAME: " + fullName + "\n");
String adress;
System.out.print("ENTER ADRESS\n");
adress = scanner.nextLine();
System.out.println("ADRESS: " + adress + "\n");
String status;
System.out.print("ENTER STATUS\n");
status = scanner.nextLine();
System.out.println("STATUS: " + status + "\n");
String schoolName;
System.out.print("ENTER SCHOOL NAME\n");
schoolName = scanner.nextLine();
System.out.println("SCHOOL NAME: " + schoolName + "\n");
int firstNumber;
System.out.print("ENTER FIRST NUMBER\n");
firstNumber = scanner.nextInt();
System.out.println("FIRST NUMBER: " + firstNumber + "\n");
int fifthNumber;
System.out.print("ENTER FIFTH NUMBER\n");
fifthNumber = scanner.nextInt();
System.out.println("FIFTH NUMBER: " + fifthNumber + "\n");
double firstDecimalNumber;
System.out.print("ENTER FIRST DECIMAL NUMBER\n");
firstDecimalNumber = scanner.nextDouble();
System.out.println("FIRST DECIMAL NUMBER: " + firstDecimalNumber + "\n");
double fifthDecimalNumber;
System.out.print("ENTER FIFTH DECIMAL NUMBER\n");
fifthDecimalNumber = scanner.nextDouble();
System.out.println("FIFTH DECIMAL NUMBER: " + fifthDecimalNumber + "\n");
}
}
Comments
Leave a comment