Sie sind auf Seite 1von 2

Create package com.

Create class Employee in com package with attributes as below. Constructor takes parameters in same
sequence as per the image. Create getters and setters.

Create class EmployeeDemo in com package with main method and other two static methods as below.

Method getEmployeeDetails will take a String array as parameter in which the Employee details are stored
as strings. Each string in the string array is stored in the below format:
employeeId-employeeName-gender-age (eg: 123-Thomas John-Male-30)
Method will parse each string stored in the String array into Employee objects and finally return an
Employee array which has all the Employee details.
Note: Assume that none of the attribute values are null.
Hint: For parsing the string array, use built-in functionalities of String. eg: contains(), substring(), split()..etc.

Method generateEmployeeId will take an employee object as parameter. It will generate an employeeId in
the below format:
EMP followed by (number of characters in their employeeName added with their employeeAge).
Eg: If the employeeName is "Raja Ram" and his employeeAge is 30, then the generated employeeId must be
The method will set the generated employeeId to the Employee object and also return the generated

Please ensure that class names, attribute names, method signature etc. is same as above. Else your code
will fail and score would be zero.

Refer below sample main method and test the output. You can copy the same code in main method and
test the implementation.

Next submit the code in iASCERT for evaluation. Also, upload the code in iON assignment activity.
Sample main method:

public static void main(String[] args) {

String[] employees = new String[5];
employees[0] = "EMP12-Arun M-Male-35";
employees[1] = "EMP523-Monica Raj-Female-27";
employees[2] = "EMP8569-Rajesh Roy-Male-17";
employees[3] = "EMP752-Jigar L-Male-48";
employees[4] = "EMP88-Sanjana Singh-Female-56";
Employee[] emp = EmployeeDemo.getEmployeeDetails(employees);
for(Employee a : emp)
System.out.println(a.getEmployeeId()+" "+a.getEmployeeName()+"
"+a.getGender()+" "+a.getAge());
Employee e = new Employee(null,"Haresh Mohan","Male",22);
String result = EmployeeDemo.generateEmployeeId(e);

Expected Output:

EMP12 Arun M Male 35

EMP523 Monica Raj Female 27
EMP8569 Rajesh Roy Male 17
EMP752 Jigar L Male 48
EMP88 Sanjana Singh Female 56