Java

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

public class Project1 {

public static void main(String args[])


{
int[] empid=new int[] {1001,1002,1003,1004,1005,1006,1007};
String[] empname=new String[]
{"Ashish","Sushma","Rahul","Chahat","Ranjan","Suman","Tanmay"};
String[] joindate=new String[]
{"01/04/1999","23/08/2012","12/11/2008","29/01/2013","16/07/2005","01/01/2000","
12/06/2006"};
char[] desigcode=new char[]{'e','c','k','r','m','e','c'};
String[] dept=new String[]{"R&D","PM","Accounts","Front
Desk","Engineering","Manufacturing","PM"};
int[] basic=new int[]{20000,30000,10000,12000,50000,23000,29000};
int[] hra=new int[]{8000,12000,8000,6000,20000,9000,12000};
int[] it=new int[]{3000,9000,1000,20000,4400,10000};
int empno=Integer.parseInt(args[0]);
int a=-1;
for(int i=0;i<empid.length;i++)
{
if(empno==empid[i])
{
a=i;
break;
}
}
if(a!=-1)
{
String Name=empname[a];
String Dept=dept[a];
String desig=null;
int salary=basic[a]+hra[a]-it[a];
switch(desigcode[a])
{
case 'e':
desig="Engineering";
salary=salary+20000;
break;
case 'c':
desig="Consultancy";
salary=salary+32000;
break;
case 'k':
desig="clerk";
salary=salary+12000;
break;
case 'r':
desig="Receptionist";
salary=salary+15000;
break;
case 'm':
desig="Manager";
salary=salary+40000;
break;
}
System.out.println("empno \t Name \t Department \t Designation \t
Salary");
System.out.println(empid[a]+" "+empname[a]+" "+dept[a]+" "+desig+"
"+salary);
}
else
{
System.out.println("invalid empid");

This study source was downloaded by 100000834089164 from CourseHero.com on 05-14-2022 21:50:52 GMT -05:00

https://www.coursehero.com/file/14914383/Employee-Detailsjava/
}
}
}

This study source was downloaded by 100000834089164 from CourseHero.com on 05-14-2022 21:50:52 GMT -05:00

https://www.coursehero.com/file/14914383/Employee-Detailsjava/
Powered by TCPDF (www.tcpdf.org)

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