Help Mr.Ben who is a programmer, in developing a registration form on 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
In Java...
Answers
Answer:
import java.util.*;
class Program
{
public static void main(String arr[])
{
String name;
int a;
String Gender;
System.out.println("Enter Your Name");
Scanner s=new Scanner(System.in);
name=s.nextLine();
System.out.println("Welcome"+name);
System.out.println("Enter your Age");
Scanner in=new Scanner(System.in);
a=in.nextInt();
System.out.println("Your Age"+a);
System.out.println("Gender");
Scanner g=new Scanner(System.in);
Gender=g.nextLine();
System.out.println("Your Gender"+Gender);
}
}
Explanation:
Answer:
import java.util.*;
import java.io.*;
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);
}
}
Explanation: