Java Print Customer Details Program

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.*;
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);
    }
}

Recommended:-

  1. Print Username
  2. Bill Generation
  3. Spell Check
  4. Highest Placement
  5. Convert Numbers into Months

Leave a Comment

Your email address will not be published. Required fields are marked *

x