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)
37 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
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
37 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
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save JAVA Worksheet 1.1.2 For Later
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
Shelf Layouts For Model Railroads
PDF
No ratings yet
Shelf Layouts For Model Railroads
89 pages
JAVA Worksheet 1
PDF
No ratings yet
JAVA Worksheet 1
4 pages
HarshJAVA Worksheet 1
PDF
No ratings yet
HarshJAVA Worksheet 1
4 pages
Ankita 1,1 (Java)
PDF
No ratings yet
Ankita 1,1 (Java)
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
JAVA 1.1 - Shubham
PDF
No ratings yet
JAVA 1.1 - Shubham
4 pages
Aditya W-1
PDF
No ratings yet
Aditya W-1
4 pages
Experiment 1
PDF
100% (1)
Experiment 1
5 pages
Amandeep Singh (20BCS5399) PBLJ Worksheet 1
PDF
No ratings yet
Amandeep Singh (20BCS5399) PBLJ Worksheet 1
5 pages
1.1 (1) - Shubh 3
PDF
No ratings yet
1.1 (1) - Shubh 3
3 pages
TM - 01 - Employee Information
PDF
No ratings yet
TM - 01 - Employee Information
4 pages
Java Ex1
PDF
No ratings yet
Java Ex1
4 pages
Experiment 1 Java
PDF
No ratings yet
Experiment 1 Java
3 pages
Exp-1.1 19BCS1431
PDF
No ratings yet
Exp-1.1 19BCS1431
6 pages
Java Applications
PDF
No ratings yet
Java Applications
5 pages
Jagriti-JAVA Exp 1
PDF
No ratings yet
Jagriti-JAVA Exp 1
3 pages
Exp 1
PDF
No ratings yet
Exp 1
4 pages
Java 1.1
PDF
No ratings yet
Java 1.1
4 pages
Experiment 1 Project Based Learning in Java
PDF
No ratings yet
Experiment 1 Project Based Learning in Java
3 pages
Java 1
PDF
No ratings yet
Java 1
3 pages
Worksheet1 1
PDF
No ratings yet
Worksheet1 1
3 pages
Java
PDF
No ratings yet
Java
2 pages
Java Program: Public Class Employee (Int Eid String Ename
PDF
No ratings yet
Java Program: Public Class Employee (Int Eid String Ename
7 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
Java 1.1 Sumit
PDF
No ratings yet
Java 1.1 Sumit
4 pages
Computer Application Project
PDF
No ratings yet
Computer Application Project
17 pages
Random
PDF
No ratings yet
Random
24 pages
OOP Lab Session 4 Q 18
PDF
No ratings yet
OOP Lab Session 4 Q 18
3 pages
Ict 3309
PDF
No ratings yet
Ict 3309
12 pages
Java Project Report On Employee Management System
PDF
100% (1)
Java Project Report On Employee Management System
16 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
PBLJ 1.1
PDF
No ratings yet
PBLJ 1.1
4 pages
JAVA ASS T
PDF
No ratings yet
JAVA ASS T
8 pages
Exercise 1
PDF
No ratings yet
Exercise 1
3 pages
LAB3
PDF
No ratings yet
LAB3
5 pages
Java Programming Lab Manual-1
PDF
No ratings yet
Java Programming Lab Manual-1
51 pages
11-Dinamic Dispatch Method
PDF
No ratings yet
11-Dinamic Dispatch Method
3 pages
PRA Practise
PDF
No ratings yet
PRA Practise
55 pages
CSE Java
PDF
No ratings yet
CSE Java
3 pages
PBLJ Lab Worksheet 1.1
PDF
No ratings yet
PBLJ Lab Worksheet 1.1
2 pages
Java 2
PDF
No ratings yet
Java 2
4 pages
Ilovepdf Merged
PDF
No ratings yet
Ilovepdf Merged
47 pages
Java
PDF
No ratings yet
Java
5 pages
Computer Program
PDF
No ratings yet
Computer Program
5 pages
Set 9
PDF
No ratings yet
Set 9
7 pages
Pij MR Support Document Chap 9
PDF
No ratings yet
Pij MR Support Document Chap 9
8 pages
HRMS
PDF
No ratings yet
HRMS
5 pages
Java 4 Nov Ques2
PDF
No ratings yet
Java 4 Nov Ques2
3 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
Java Project Code
PDF
No ratings yet
Java Project Code
9 pages
Oop Reference Manual - Final
PDF
No ratings yet
Oop Reference Manual - Final
75 pages
Assignment# 2
PDF
No ratings yet
Assignment# 2
5 pages
Bafana Magubane - 1913427 - 0
PDF
No ratings yet
Bafana Magubane - 1913427 - 0
5 pages
Comsats University Islamabad Wah Campus Object Oriented Programming
PDF
No ratings yet
Comsats University Islamabad Wah Campus Object Oriented Programming
6 pages
Java Lab
PDF
No ratings yet
Java Lab
30 pages
Java 2.4 Nites
PDF
No ratings yet
Java 2.4 Nites
5 pages
Core Java Programming (CE0421)
PDF
No ratings yet
Core Java Programming (CE0421)
2 pages
Lab4-Inheritance PhoneNumber Person
PDF
No ratings yet
Lab4-Inheritance PhoneNumber Person
4 pages
LAB2
PDF
No ratings yet
LAB2
12 pages
Abdullah Ayub (002) Oose Lab #2: Eclipse
PDF
No ratings yet
Abdullah Ayub (002) Oose Lab #2: Eclipse
6 pages
Computer Engineering Laboratory Solution Primer
From Everand
Computer Engineering Laboratory Solution Primer
Karan Bhandari
No ratings yet
Experiment1 1
PDF
No ratings yet
Experiment1 1
6 pages
JAVA Worksheet 2.1.2.34
PDF
No ratings yet
JAVA Worksheet 2.1.2.34
5 pages
Unit - 2 - Notes - by - Er Megha Sharma
PDF
No ratings yet
Unit - 2 - Notes - by - Er Megha Sharma
12 pages
Os Complete Notes
PDF
No ratings yet
Os Complete Notes
63 pages
MIRUTS Wobari Last Pay.
PDF
No ratings yet
MIRUTS Wobari Last Pay.
31 pages
Cricket Practice Net Construction
PDF
No ratings yet
Cricket Practice Net Construction
4 pages
KARYA TULIS SMP NEGERI 2 TANGEN Bajra Sandhi
PDF
No ratings yet
KARYA TULIS SMP NEGERI 2 TANGEN Bajra Sandhi
29 pages
Fire Nfpa 20
PDF
100% (4)
Fire Nfpa 20
25 pages
2014 - 0011b Pipe Sizing For Water Supply and Distribution
PDF
100% (1)
2014 - 0011b Pipe Sizing For Water Supply and Distribution
34 pages
SN-803-2020 Staron Exterior Wall Cladding
PDF
No ratings yet
SN-803-2020 Staron Exterior Wall Cladding
13 pages
Legend of Codes CFC 1 - A: CF DWG AR - Nhqc2 00 - S001
PDF
No ratings yet
Legend of Codes CFC 1 - A: CF DWG AR - Nhqc2 00 - S001
1 page
Presentación Ingles Casa de Los Sueños
PDF
No ratings yet
Presentación Ingles Casa de Los Sueños
5 pages
Ancient Greek Architecture
PDF
100% (1)
Ancient Greek Architecture
12 pages
Types of Forts in India
PDF
No ratings yet
Types of Forts in India
19 pages
FloodPy On Windows 10 or 11.
PDF
No ratings yet
FloodPy On Windows 10 or 11.
2 pages
Famous Mosque in Iraq
PDF
No ratings yet
Famous Mosque in Iraq
7 pages
Tama Art University Library Case Study
PDF
No ratings yet
Tama Art University Library Case Study
19 pages
Number 189 Silo Construction Article 1
PDF
No ratings yet
Number 189 Silo Construction Article 1
57 pages
Cad Final Final Final Final
PDF
No ratings yet
Cad Final Final Final Final
1 page
Resume Tarun Sharma
PDF
No ratings yet
Resume Tarun Sharma
3 pages
Burj Al Arab PDF
PDF
No ratings yet
Burj Al Arab PDF
2 pages
Exercise 21.4
PDF
No ratings yet
Exercise 21.4
18 pages
TN17 Weather Tightness & Drainage
PDF
No ratings yet
TN17 Weather Tightness & Drainage
7 pages
Richard Wesley - Future of Architectural Theory
PDF
No ratings yet
Richard Wesley - Future of Architectural Theory
1 page
Practical No 4 (WBP)
PDF
No ratings yet
Practical No 4 (WBP)
3 pages
Project - 2 (Sports Stadium)
PDF
No ratings yet
Project - 2 (Sports Stadium)
7 pages
Scope of Services - FLS
PDF
No ratings yet
Scope of Services - FLS
2 pages
Mod Menu Crash 2023 03 19-14 11 37
PDF
No ratings yet
Mod Menu Crash 2023 03 19-14 11 37
4 pages
Notes:: On This Drawing Are The Information and Representations
PDF
No ratings yet
Notes:: On This Drawing Are The Information and Representations
1 page
We-1901-Civ-Fnc-0003 - R0 - Fencing Details of Switchyard PDF
PDF
No ratings yet
We-1901-Civ-Fnc-0003 - R0 - Fencing Details of Switchyard PDF
2 pages
List of Low Rise Buildings & Productivity Monitoring Form
PDF
No ratings yet
List of Low Rise Buildings & Productivity Monitoring Form
7 pages
Early Christian Architecture
PDF
No ratings yet
Early Christian Architecture
3 pages
I. Parking and Loading Zone... : Diagram of Van Accessible Parking Space Elements
PDF
No ratings yet
I. Parking and Loading Zone... : Diagram of Van Accessible Parking Space Elements
37 pages