Question
Help Mr.Ben who is a programmer in developing a registration form on the console. Customers will not just input data but also view the details once he/she finishes the registration.
Sample Input 1:
Enter your name:Jany
Enter age:25
Enter gender:Female
Hailing from:Mexico
Sample Output 1:
Welcome, Jany!
Age:25
Gender:Female
City:Mexico
Code :-
import java.util.Scanner; public class Customer{ public static void main(String args[]){ Scanner sc=new Scanner(System.in); System.out.println("Enter your name:"); String name=sc.nextLine(); System.out.println("Enter age:"); int age=sc.nextInt(); System.out.println("Enter gender:"); String gender=sc.next(); sc.nextLine(); System.out.println("Hailing from:"); String from=sc.nextLine(); System.out.println("Welcome," +name+"!"); System.out.println("Age:"+age); System.out.println("Gender:"+gender); System.out.println("City:"+from); } }