0% found this document useful (0 votes)
72 views

Worksheet 1.1 Java

The document outlines an experiment conducted by a student to implement Worksheet 1.1 in Java, which involves creating arrays to store employee data like ID, name, department, and calculating employee salaries based on their designation. The student codes a program that takes an employee ID as input and searches the arrays to find the employee details and prints their information including calculated salary. The student also defines methods to return designation strings and DA amounts based on employee designation character.

Uploaded by

rajat maheshwari
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
72 views

Worksheet 1.1 Java

The document outlines an experiment conducted by a student to implement Worksheet 1.1 in Java, which involves creating arrays to store employee data like ID, name, department, and calculating employee salaries based on their designation. The student codes a program that takes an employee ID as input and searches the arrays to find the employee details and prints their information including calculated salary. The student also defines methods to return designation strings and DA amounts based on employee designation character.

Uploaded by

rajat maheshwari
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Experiment:- 1.

Student Name:Abhishek UID:18bcs6518


Branch: cse Section/Group
Semester: 6 Date of Performance:
Subject Name : java 1.1 Subject Code:

1. Aim/Overview of the practical:


the Worksheet 1.1 to be implemented.

2. Task to be done/ Which logistics used:

3. Steps for experiment/practical/Code:

package project1;
import java.util.Scanner;
public class Array 
{
public static void main(String args[])
{
Scanner arr = new Scanner(System.in);
int capacity = 7;

int eno[] = {1001, 1002, 1003, 1004, 1005, 1006, 1007};


String ename[] = {"Ashish", "Sushma", "Rahul", "Chahat", "Ranjan", "Suman", "Tanmay"};
String dpt[] = {"R&D", "PM", "Acct", "Front Desk", "Eng", "Manufacturer", "PM"};
char dcode[] = {'e', 'c', 'k', 'r', 'm', 'e', 'c'};
int basic[] = {20000, 3000, 10000, 12000, 9000, 12000};
int hra[] = {8000, 12000, 80000, 6000, 200000, 9000, 12000};
int it[] = {3000, 9000, 1000, 2000, 20000, 4400, 10000};

System.out.print("Enter the employee ID: ");

int eid = arr.nextInt();

boolean check = false;

int x = 0;

for(int i = 0;i<capacity;i++)
{
if(eno[i] == eid)
{
check = true;
x = i;
break;
}
}
if(check == false)
{
System.out.print("NO ID found!"+eid+"\tPlease enter correct one ");
}
else
{
System.out.print("Employee No \tEmp Name\tDepartment\tDesignation\tSalary");
System.out.print(eno[x]+ "\t");
System.out.print(ename[x]+ "\t\t");
System.out.print(dpt[x]+ "\t\t");
System.out.print(dcode(dcode[x])+ "\t\t");

int Salary = basic[x] + hra[x] + da(dcode[x]) - it[x];

System.out.print(Salary);

}
}

static String dcode(char ch)


{
switch(ch)
{
case 'e': return "Engineer";

case 'c': return "Consultant";

case 'k': return "Clerk";

case 'r': return "Receptionist";


case 'm': return "Manager";
}

return "Invalid";
}

static int da(char ch) 


{

  switch(ch) 
  {

  case 'e': return 20000;

  case 'c': return 32000;

  case 'k': return 12000;

  case 'r': return 15000;

  case 'm': return 40000;

  } 

  return 0;
}

4. Result/Output/Writing Summary:
Learning outcomes (What I have learnt):

1.

2.

3.

4.

5.
Evaluation Grid (To be created as per the SOP and Assessment guidelines by the faculty):

Sr. No. Parameters Marks Obtained Maximum Marks


1.
2.
3.

You might also like