Friday, February 14, 2020

Enter Employee Details in java program.

 Employee Details in java program. 

import java.util.Scanner;
public class EmployeeDetails
{
            public void employee(String name, int id ,String address ,int salary ,String stream)
        {
            System.out.println( "Employee name:"+ name);
            System.out.println("Employee id no:" + id );
            System.out.println("Employee address:" +  address );
            System.out.println("Employee salary:" + salary );
             System.out.println("Employee stream:" + stream);
   
        }
   
    public static void main(String[] args)
        {
            Scanner sc=new Scanner(System.in);
            EmployeeDetails ed=new EmployeeDetails();
            System.out.println("Employee name:");
            String name=sc.next();
            System.out.println("Employee id no:");
            int  id=sc.nextInt();
            System.out.println("Employee address");
            String address=sc.next();
            System.out.println("Employee salary");
            int salary=sc.nextInt();
            System.out.println("Employee stream");
            String stream=sc.next();
            sc.close ();
            ed.employee(name , id , address , salary ,stream);
        }
}

No comments:

Post a Comment