Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
35 views
4 pages
JAVA Worksheet 1.1.2
Uploaded by
veer371karan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download
Save
Save JAVA Worksheet 1.1.2 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
35 views
4 pages
JAVA Worksheet 1.1.2
Uploaded by
veer371karan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save JAVA Worksheet 1.1.2 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 4
Search
Fullscreen
Experiment1.
Student Name:Shashi Ranjan Mehta UID: 21BCS7093
Branch:BE-CSE Section/Group:CC-FL-601
Semester: 6 Date of Performance:13-01-2024
Subject Name: Java Lab
Subject Code:21CSH-319
1. Aim: Create a application to save the employee information using arrays
2. Objective: 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 details
3. Algo. /Approach and output:
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
class Employee {
int empNo;
String empName;
Date joinDate;
char desigCode;
String department;
double basic;
double hra;
double it;
public Employee(int empNo, String empName, String joinDate, char
desigCode, String department, double basic, double hra, double it) throws
ParseException {
this.empNo = empNo;
this.empName = empName;
this.joinDate = new
SimpleDateFormat("dd/MM/yyyy").parse(joinDate);
this.desigCode = desigCode;
this.department = department;
this.basic = basic;
this.hra = hra;
this.it = it;
}
public double calculateSalary() {
double da = getDA();
return basic + hra + da - it;
}
public String getDesignation() {
switch (desigCode) {
case 'e':
return "Engineer";
case 'c':
return "Consultant";
case 'k':
return "Clerk";
case 'r':
return "Receptionist";
case 'm':
return "Manager";
default:
return "Unknown";
}
}
private double getDA() {
switch (desigCode) {
case 'e':
return 20000;
case 'c':
return 32000;
case 'k':
return 12000;
case 'r':
return 15000;
case 'm':
return 40000;
default:
return 0;
}
}
}
public class Project1 {
public static void main(String[] args) {
if (args.length != 1) {
System.out.println("Usage: java Project1 <EmpNo>");
return;
}
int empNo = Integer.parseInt(args[0]);
Employee[] employees = new Employee[7];
try {
employees[0] = new Employee(1001, "Ashish", "01/04/2009", 'e',
"R&D", 20000, 8000, 3000);
employees[1] = new Employee(1002, "Shashi", "23/08/2012", 'c',
"PM", 30000, 12000, 9000);
employees[2] = new Employee(1003, "Rahul", "12/11/2008", 'k',
"Acct", 10000, 8000, 1000);
employees[3] = new Employee(1004, "Chahat", "29/01/2013", 'r',
"Front Desk", 12000, 6000, 2000);
employees[4] = new Employee(1005, "Ranjan", "16/07/2005", 'm',
"Engg", 50000, 20000, 20000);
employees[5] = new Employee(1006, "Suman", "01/01/2000", 'e',
"Manufacturing", 23000, 9000, 4400);
employees[6] = new Employee(1007, "Tanmay", "12/06/2006", 'c',
"PM", 29000, 12000, 10000);
} catch (ParseException e) {
e.printStackTrace();
}
boolean found = false;
for (Employee employee : employees) {
if (employee != null && employee.empNo == empNo) {
found = true;
System.out.println("Emp No.\tEmp Name\tDepartment\
tDesignation\tSalary");
System.out.println(employee.empNo + "\t" + employee.empName
+ "\t" + employee.department + "\t" + employee.getDesignation() + "\t" +
employee.calculateSalary());
break;
}
}
if (!found) {
System.out.println("There is no employee with empid : " + empNo);
}
}
}
Output:
You might also like
Ilovepdf Merged
PDF
No ratings yet
Ilovepdf Merged
47 pages
Java Programming Lab Manual-1
PDF
No ratings yet
Java Programming Lab Manual-1
51 pages
Java lab
PDF
No ratings yet
Java lab
30 pages
Oop Reference Manual _final
PDF
No ratings yet
Oop Reference Manual _final
75 pages
Random
PDF
No ratings yet
Random
24 pages
PRA Practise
PDF
No ratings yet
PRA Practise
55 pages
LAB2
PDF
No ratings yet
LAB2
12 pages
Java Project Code
PDF
No ratings yet
Java Project Code
9 pages
Set9
PDF
No ratings yet
Set9
7 pages
java applications
PDF
No ratings yet
java applications
5 pages
BAFANA MAGUBANE_1913427_0
PDF
No ratings yet
BAFANA MAGUBANE_1913427_0
5 pages
LAB3
PDF
No ratings yet
LAB3
5 pages
Java
PDF
No ratings yet
Java
5 pages
Comsats University Islamabad Wah Campus Object Oriented Programming
PDF
No ratings yet
Comsats University Islamabad Wah Campus Object Oriented Programming
6 pages
Assignment# 2
PDF
No ratings yet
Assignment# 2
5 pages
Java Ex1
PDF
No ratings yet
Java Ex1
4 pages
Java 1.1 Sumit
PDF
No ratings yet
Java 1.1 Sumit
4 pages
Exercise 1
PDF
No ratings yet
Exercise 1
3 pages
Java 1.1
PDF
No ratings yet
Java 1.1
4 pages
PBLJ 1.1
PDF
No ratings yet
PBLJ 1.1
4 pages
Jagriti-JAVA Exp 1
PDF
No ratings yet
Jagriti-JAVA Exp 1
3 pages
4.2
PDF
No ratings yet
4.2
2 pages
Amandeep Singh (20BCS5399) PBLJ Worksheet 1
PDF
No ratings yet
Amandeep Singh (20BCS5399) PBLJ Worksheet 1
5 pages
Java 2
PDF
No ratings yet
Java 2
4 pages
Java 4 Nov Ques2
PDF
No ratings yet
Java 4 Nov Ques2
3 pages
Experiment 1
PDF
100% (1)
Experiment 1
5 pages
CSE Java
PDF
No ratings yet
CSE Java
3 pages
Ict 3309
PDF
No ratings yet
Ict 3309
12 pages
TM - 01 - Employee Information
PDF
No ratings yet
TM - 01 - Employee Information
4 pages
OOP Lab Session 4 Q 18
PDF
No ratings yet
OOP Lab Session 4 Q 18
3 pages
HarshJAVA Worksheet 1
PDF
No ratings yet
HarshJAVA Worksheet 1
4 pages
JAVA.ASS.t
PDF
No ratings yet
JAVA.ASS.t
8 pages
Ankita 1,1(Java).Docx (1)
PDF
No ratings yet
Ankita 1,1(Java).Docx (1)
5 pages
Java 2.4 Nites
PDF
No ratings yet
Java 2.4 Nites
5 pages
HRMS
PDF
No ratings yet
HRMS
5 pages
Computer Program
PDF
No ratings yet
Computer Program
5 pages
exp_1
PDF
No ratings yet
exp_1
4 pages
Homework #1: Please Refer To The Code in The Appendix (Pages 2 - 6) To Answer The Following Questions
PDF
No ratings yet
Homework #1: Please Refer To The Code in The Appendix (Pages 2 - 6) To Answer The Following Questions
5 pages
11-DINAMIC DISPATCH METHOD
PDF
No ratings yet
11-DINAMIC DISPATCH METHOD
3 pages
Exp-1.1 19BCS1431
PDF
No ratings yet
Exp-1.1 19BCS1431
6 pages
Lab4-Inheritance PhoneNumber Person
PDF
No ratings yet
Lab4-Inheritance PhoneNumber Person
4 pages
Java 1
PDF
No ratings yet
Java 1
3 pages
Abdullah Ayub (002) Oose Lab #2: Eclipse
PDF
No ratings yet
Abdullah Ayub (002) Oose Lab #2: Eclipse
6 pages
Informática 11 Edit
PDF
No ratings yet
Informática 11 Edit
60 pages
Experiment 1 project based learning in java
PDF
No ratings yet
Experiment 1 project based learning in java
3 pages
JAVA Worksheet 1
PDF
No ratings yet
JAVA Worksheet 1
4 pages
Create A Application To Save The Employee Information Using Arrays.
PDF
No ratings yet
Create A Application To Save The Employee Information Using Arrays.
3 pages
1.1 (1) - Shubh 3
PDF
No ratings yet
1.1 (1) - Shubh 3
3 pages
BSIT-S20-011 - FYP Final Report
PDF
No ratings yet
BSIT-S20-011 - FYP Final Report
42 pages
Pij MR Support Document Chap 9
PDF
No ratings yet
Pij MR Support Document Chap 9
8 pages
Policy-Based Reinforcement Learning: Shusen Wang
PDF
No ratings yet
Policy-Based Reinforcement Learning: Shusen Wang
46 pages
Aditya_W-1
PDF
No ratings yet
Aditya_W-1
4 pages
Create 4 Class Person, Staff, Temporarystaff and A Main Class - .
PDF
No ratings yet
Create 4 Class Person, Staff, Temporarystaff and A Main Class - .
7 pages
800-19340V2-A Performance Series IP NVR User Guide WEB PDF
PDF
No ratings yet
800-19340V2-A Performance Series IP NVR User Guide WEB PDF
276 pages
JAVA 1.1 - Shubham
PDF
No ratings yet
JAVA 1.1 - Shubham
4 pages
Java Project Report On Employee Management System
PDF
100% (1)
Java Project Report On Employee Management System
16 pages
PBLJ Lab Worksheet 1.1
PDF
No ratings yet
PBLJ Lab Worksheet 1.1
2 pages
P. Borwein. Ramanujan, Modular Equations, and Approximations To Pi
PDF
100% (1)
P. Borwein. Ramanujan, Modular Equations, and Approximations To Pi
40 pages
Computer Application Project
PDF
No ratings yet
Computer Application Project
17 pages
MegaPixel IPCamera
PDF
No ratings yet
MegaPixel IPCamera
46 pages
Os Complete Notes
PDF
No ratings yet
Os Complete Notes
63 pages
12 WindPRO3.5-Meteorological Data Handling
PDF
No ratings yet
12 WindPRO3.5-Meteorological Data Handling
82 pages
Sorsogon National High School: Common Text Structures
PDF
No ratings yet
Sorsogon National High School: Common Text Structures
8 pages
Python Fundamentals: Files and Resource Management
PDF
No ratings yet
Python Fundamentals: Files and Resource Management
24 pages
A10 DS Thunder TPS
PDF
No ratings yet
A10 DS Thunder TPS
13 pages
Brochure PythonForManagers 07-07-2022 V57
PDF
No ratings yet
Brochure PythonForManagers 07-07-2022 V57
17 pages
19ECS448P Secure Software Engineering - Lab Manual
PDF
No ratings yet
19ECS448P Secure Software Engineering - Lab Manual
26 pages
How To Send Submissions Via The Web Client - User Guidance
PDF
No ratings yet
How To Send Submissions Via The Web Client - User Guidance
17 pages
MC-10238798-0001
PDF
No ratings yet
MC-10238798-0001
12 pages
Experiment 1 Java
PDF
No ratings yet
Experiment 1 Java
3 pages
Unit - 2 - Notes - by - Er Megha Sharma
PDF
No ratings yet
Unit - 2 - Notes - by - Er Megha Sharma
12 pages
10 Graphs of Polynomial Functions
PDF
No ratings yet
10 Graphs of Polynomial Functions
25 pages
Commercials of Mx-ERP
PDF
No ratings yet
Commercials of Mx-ERP
11 pages
Tting Nasadmin and Root Privileges On VNXe1 Series
PDF
No ratings yet
Tting Nasadmin and Root Privileges On VNXe1 Series
6 pages
Canada Anthem
PDF
No ratings yet
Canada Anthem
7 pages
RCA COSMAC Microkit
PDF
No ratings yet
RCA COSMAC Microkit
8 pages
Worksheet1 1
PDF
No ratings yet
Worksheet1 1
3 pages
Nipun Gupta Resume CS v3.2
PDF
No ratings yet
Nipun Gupta Resume CS v3.2
4 pages
New
PDF
No ratings yet
New
7 pages
Experiment1 1
PDF
No ratings yet
Experiment1 1
6 pages
Vex Report
PDF
No ratings yet
Vex Report
6 pages
Uniview Push Installer App - 3dEYE
PDF
No ratings yet
Uniview Push Installer App - 3dEYE
4 pages
PDMS安装与设置
PDF
No ratings yet
PDMS安装与设置
3 pages
JAVA Worksheet 2.1.2.34
PDF
No ratings yet
JAVA Worksheet 2.1.2.34
5 pages
Australian Standard: Timber Structures Part 4: Fire-Resistance of Structural Timber Members
PDF
No ratings yet
Australian Standard: Timber Structures Part 4: Fire-Resistance of Structural Timber Members
11 pages
Implementation of MANET Routing Protocols On OMNeT
PDF
No ratings yet
Implementation of MANET Routing Protocols On OMNeT
5 pages
Experiment-1 Aim:: Create An Application To Save The Employee Information Using Arrays
PDF
No ratings yet
Experiment-1 Aim:: Create An Application To Save The Employee Information Using Arrays
6 pages
Plant Pals Operations Project Statement of Work: Project Lead: Project Sponsor: Revision History
PDF
100% (2)
Plant Pals Operations Project Statement of Work: Project Lead: Project Sponsor: Revision History
2 pages
Resume Template (MAKE A COPY)
PDF
No ratings yet
Resume Template (MAKE A COPY)
2 pages
Parable of The Rainbow
PDF
No ratings yet
Parable of The Rainbow
3 pages
Java
PDF
No ratings yet
Java
2 pages
Remedial Instruction
PDF
No ratings yet
Remedial Instruction
3 pages
Computer Engineering Laboratory Solution Primer
From Everand
Computer Engineering Laboratory Solution Primer
Karan Bhandari
No ratings yet
TENDER BOQ TELECOM Abhishek
PDF
No ratings yet
TENDER BOQ TELECOM Abhishek
3 pages