0% found this document useful (0 votes)
20 views4 pages

Aditya W-1

Uploaded by

arajo4688
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views4 pages

Aditya W-1

Uploaded by

arajo4688
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Experiment No - 1

Student Name: Aditya Kumar UID:19CBS3048


Branch: CSE Section/Group: NTPP_IS_1/A
Semester: 6th Date of Performance: 10/02/22
Subject Name: Project based learning in Java Subject Code: CSP-358

1. Aim/Overview of the practical:


Given the following table containing information about employees of an organization, develop a small
java application, which accepts employee id from the command prompt and displays the following
details as output:

2.Steps for experiment/practical/Code:


import java.util.Scanner;
class Main
{
public static void main(String[] args) {

Scanner input=new Scanner(System.in);

int[] empNo={1001,1002,1003,1004,1005,1006,1007};
String[] empName={"Ashish","Sushma","Rahul","Chahat","Ranjan","Suman","Tranmay"};
String[]
joinDate={"01/04/2009","23/08/2012","12/11/2008","29/01/2013","16/07/2005","1/1/2000","12/06/
2006"};
char[] designCode={'e','c','k','r','m','e','c'};
String[] dept={"R&D","PM","ACCT","FRONTDESK","ENGG","MANUFACTURE","PM"};
int[] basic={20000,30000,10000,12000,50000,23000,29000};
int[] hra={8000,12000,8000,6000,20000,9000,12000};
int[] it={3000,9000,1000,2000,200000,4400,10000};

int noOfEmp=empNo.length;
String[] designation = new String[noOfEmp];
// calculate DA
int[] da=new int [noOfEmp];
for(int i=0;i<noOfEmp;i++){
switch(designCode[i]){
case 'e':da[i]=20000;designation[i]="Engineer";
break;
case 'c':da[i]=32000;designation[i]="Consultant";
break;
case 'k':da[i]=12000;designation[i]="Clerk";
break;
case 'r':da[i]=15000;designation[i]="Receptionist";
break;
case 'm':da[i]=40000;designation[i]="Manager";
break;
}
}

//Calculate Salary
int[] salary=new int[noOfEmp];
for(int i=0;i<noOfEmp;i++){
salary[i]=basic[i]+hra[i]+da[i]+it[i];
}

while(true){
System.out.println("Enter the user Id in --> ");
String a=input.next();
try{
int searchID = Integer.parseInt(a);
System.out.println("Searched ID is --> "+ searchID);
boolean result=true;
for(int i=0;i<noOfEmp;i++){
if(searchID==empNo[i]){
System.out.println("Details of Given ID is as follow --> ");
System.out.println("Employee ID || Employee Name || Joining Date ||
Designigation || Deparment || Basic || HRA || IT || DA || Salary");
System.out.println(empNo[i]+"\t\t"+empName[i]+"\t\t"+joinDate[i]+"\t
"+designation[i]+"\t "+dept[i]+"\t "+
basic[i]+" "+hra[i]+" "+it[i]+" "+da[i]+" "+salary[i]);
result=true;
break;
}else{
result=false;
continue;
}
}
if(result==false){
System.out.println(searchID+" ID is not present");
}
}
catch(NumberFormatException e){
System.out.println("Input string can't br parseed to interger"+ e);
}
}
}
}

3. OUTPUT :

4. Learning outcomes (What I have learnt):

- Learned the concept of switch case in java in how to implement them


- Learned about arrays in java and how to implement them

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

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy