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

java 1.1 kartik

The document outlines a project-based learning curriculum for Java programming in a Computer Science and Engineering department. It includes a series of experiments focused on creating applications for employee information management, inventory control, and various data structures. The document also provides a detailed example of an application to save employee information using arrays, including code snippets and expected outputs.

Uploaded by

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

java 1.1 kartik

The document outlines a project-based learning curriculum for Java programming in a Computer Science and Engineering department. It includes a series of experiments focused on creating applications for employee information management, inventory control, and various data structures. The document also provides a detailed example of an application to save employee information using arrays, including code snippets and expected outputs.

Uploaded by

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

UNIVERSITY INSTITUTE OF ENGINEERING

Department of Computer Science & Engineering


(BE-CSE/IT-6th Sem)

Project Based Learning in Java with Lab

21CSH-319/21ITH-319

Submitted to: Submitted by:


Name: Suman Kumar

UID: 21BCS1276

Section: CC-605-B

Group: A
INDEX

Name: Suman Kumar UID: 21BCS1276

Ex. Name of experiments Date Conduct Viva Worksheet Total Remarks Signature
No. (MM:12) (MM:10) (Record) (MM:30) (with date)
(MM:8)
1.1 Create an application
to save the employee
information using
arrays
1.2 Design and
implement a simple
inventory control
system for a small
video rental store.
1.3 Create an application
to calculate interest
for FDs,RDs based on
certain
conditions using
inheritance
2.1 Create a program to
collect and store all
the cards to assist the
users infinding all the
cards in a given
symbol using
Collection interface.
2.2 Create a program to
collect unique
symbols
from a set of cards
usingset interface.
2.3 Write a Program to
perform the basic
operations like insert,
delete, display and
search in list. List
contains Stringobject
items where these
operations are to be
performed.
2.4 Create a menu-based
Java application with
the following options.
1.Add an Employee 2.
Display All 3. Exit If
option 1 is selected,
the application should
gather details of the
designation and salary
and store it in a file.
3.1 Create a palindrome
creator application for
making a longest
possiblepalindrome
out of given
input string.
3.2 Create JSP application
for addition,
multiplication and
division.

3.3 Create an application


for online auction
using Servlet and
JSP.
DEPARTMENT OF
COMPUTER SCIENCE &
ENGINEERING

Experiment 1.1
Student Name: Kartik Sahu UID: 21BCS11509
Branch: BE-CSE Section/Group: FL-602
Semester: 6th Date of Performance:16/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. Script 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;
DEPARTMENT OF
COMPUTER SCIENCE &
ENGINEERING

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;
DEPARTMENT OF
COMPUTER SCIENCE &
ENGINEERING

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(1, "Kartik", "01/04/2009", 'e', "R&D",
20000, 8000, 3000);
employees[1] = new Employee(2, "Ansh", "23/08/2012", 'c', "PM",
30000, 12000, 9000);
employees[2] = new Employee(3, "Abhishek", "12/11/2008", 'k',
"Acct", 10000, 8000, 1000);
employees[3] = new Employee(4, "Shruti", "29/01/2013", 'r', "Front
Desk", 12000, 6000, 2000);
employees[4] = new Employee(5, "Ranjan", "16/07/2005", 'm',
"Engg", 50000, 20000, 20000);
employees[5] = new Employee(6, "Suman", "01/01/2000", 'e',
"Manufacturing", 23000, 9000, 4400);
employees[6] = new Employee(7, "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");
DEPARTMENT OF
COMPUTER SCIENCE &
ENGINEERING

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