Latest Activity In Study Groups

Join Your Study Groups

VU Past Papers, MCQs and More

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

Assignment No. 01
SEMESTER Fall 2021
CS506- Web Design and Development

 

Total Marks: 20

 

Due Date: 09/12/2021

Instructions

Please read the following instructions carefully before solving & submitting assignment:

It should be clear that your assignment will not get any credit if:

  1. The assignment is submitted after due date.
  2. The submitted assignment does not open or file corrupt.
  3. The assignment is full or partially copied from (other student or ditto copy from handouts or internet).
  4. Student ID is not mentioned in the assignment File or name of file is other than student ID.
  5. The assignment is not submitted .java format.

 

Uploading instructions

Your submission must include:

 

  1. All the source code (.java files), class files (.class extension), and other if necessary, files to compile and run your program.
  2. Your assignment should be in .zip /.rar format. Other file formats will not be accepted.
  3. Save your assignment with your ID (e.g. bc000000000.zip).

 

Note: Use Notepad or Notepad++ for coding and JDK package for java source code compilation and running.

(A video tutorial of JDK installation and configuration is given in course download section)

Link: https://vulms.vu.edu.pk/Courses/CS506/Downloads/JDK_Installation.mp4

Objective

The objective of this assignment is to give you some practice exercise of file handling and understanding in java console programs.

 

Important Requirements and Instructions:

  1. You are not allowed to use any IDE tool like NetBeans in this assignment.
  2. Use text file (empData.txt) attached with assignment file. Your code should work with given attached text file.
  3. Use text file and java files in same directory.
  4. Create Employee.java which will contain Employee information (empId, empName, empDoB, empQualf, empExp, and empPScale).
  5. Create Main.java file which will read data from text file and also enable user to add, search, exit (see output screen shot). 
  6. Complete all requirements given below.
  7. Assignment due date is 09/12/2021.
  8. We will not accept assignment through email in any case. Be Careful

Lectures Covered: This assignment covers Lecture # 1-9

 

For any query about the assignment, contact at cs506@vu.edu.pk

GOOD LUCK

 

 

Problem Statement:

You are required to develop a simple java-based application named as Employee Information for a typical human resource management system. In this application, user will be able to perform the following task via GUI:

  1. Add employee information and store them in a text file named “empData.txt”
  2. Search an employee using employee ID
  3. Exit the program

 

For this purpose, you have to create a text file (i.e. empData.txt) and two java classes (i.e. Employee and Main). Data members and member functions of these classes are given below;

 

Note: There should be two different Java files which contain these classes.

 

Employee class must have the following data members & member functions:

•                      empId: String   

•                      empName: String

•                      empDoB: String

•                      empQualf: String

•                      empExp: String

•                     empPScale: String

•                     Constructors: Explicit Default Constructor

•                     Standard Setters: setEmpID(…), setEmpName(…), setEmpDoB(…), setEmpQualf(…), setEmpExp(…), setExpPScale(…).

•                     Standard Getters: getEmpID(), getEmpName(), getEmpDoB(), getEmpQualf(), getEmpExp(), getEmpPScale().

Main class should contain the main () method. At first, it should load data from text file (i.e. empData.txt) and save in ArrayList. After that, the interface should display following options:

 

1.      Add a new Employee 

2.      Search an Employee

3.      Exit

 

 

 

1. Add a new Employee:

 

Each time, user selects this option, s/he will be prompted to enter new employee information (i.e. empId, empName, empDoB, empQualf, empExp, and empPScale)). If inputs are correct (i.e., found no empty value) then new employee information will be added in ArrayList, otherwise a message should be displayed "Invalid input".

 

 

 

 

 

 

 

For incorrect inputs following message will show:

 

 

2. Search an Employee:

 

In order to search an employee, user will be asked to provide an Employee ID. The application will search corresponding employee in ArrayList. If employee is found, history will be displayed to user. Otherwise, a message should be displayed "Employee not found".

 

 

 

 

 

In case of entering incorrect Employee ID:

 

 

          

 

3. Exit:

 

            Exit option will terminate the program by saving all ArrayList data back to text file (i.e., empeData.txt) and showing the developer information (i.e., Student own Id and name) via GUI.

You will print your own VU ID and Name otherwise you will get zero marks.

 

 

 

Hints:

To manage employee information use Employee class.

To store multiple employee records use ArrayList.

 

Note: Your code must justify enough for 20 marks.

Deadline

Your assignment must be uploaded/submitted at or before 09/12/2021.                         

 

 

Views: 1020

Attachments:

Replies to This Discussion

Stay touched with this discussion, Solution idea will be uploaded as soon as possible in replies here before the due date.

last date is 9 dec

CS 506 Assignment 1 Fall 2021 Solution file link 

CS506-Assignment-1-Solution-Fall-2021-By-VU-Ning.pdf

CS506 One more idea solution file link 

CS506-Assig%2301-Solution-Fall-2021.pdf

CS506 Assignment 1 Fall 2021 solution idea:

 

Code:

Employee.java

public class Employee {

private String empId;
private String empName;
private String empDoB;
private String empQualf;
private String empExp;
private String empPScale;

// default constructo
public Employee() {

}

// parametarized constructor
public Employee(String empId, String empName, String empDoB, String empQualf, String empExp, String empPScale) {
this.empId = empId;
this.empName = empName;
this.empDoB = empDoB;
this.empQualf = empQualf;
this.empExp = empExp;
this.empPScale = empPScale;
}

// getter and setter
public String getEmpId() {
return empId;
}

public void setEmpId(String empId) {
this.empId = empId;
}

public String getEmpName() {
return empName;
}

public void setEmpName(String empName) {
this.empName = empName;
}

public String getEmpDoB() {
return empDoB;
}

public void setEmpDoB(String empDoB) {
this.empDoB = empDoB;
}

public String getEmpQualf() {
return empQualf;
}

public void setEmpQualf(String empQualf) {
this.empQualf = empQualf;
}

public String getEmpExp() {
return empExp;
}

public void setEmpExp(String empExp) {
this.empExp = empExp;
}

public String getEmpPScale() {
return empPScale;
}

public void setEmpPScale(String empPScale) {
this.empPScale = empPScale;
}

}

Main.java

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import javax.swing.JOptionPane;

public class Main {

public static void main(String[] args) {
while (true) {

String number = JOptionPane.showInputDialog("Please Ener \n "
+ "1 for ' add new Employee'"
+ " \n 2 for ' search in employee' \n"
+ "3 for ' Exit ' ");

int convertnumber = Integer.parseInt(number);

if (convertnumber == 1) {

addEmployee();
} else if (convertnumber == 2) {
String eId = JOptionPane.showInputDialog("Enter Id to search");
searchEmploye(eId);
} else if (convertnumber == 3) {
JOptionPane.showMessageDialog(null,);
System.exit(0);
} else {
JOptionPane.showMessageDialog(null, "Invalid ");
}

}//end of while

}

// String id
public static void searchEmploye(String eId) {

try {
String tokens[] = null;
String id, name, dob, qual, expe, payS;
FileReader fr = new FileReader("empData.txt");
BufferedReader br = new BufferedReader(fr);

String line = br.readLine();

while (line != null) {
tokens = line.split(",");
id = tokens[0];
name = tokens[1];
dob = tokens[2];
qual = tokens[3];
expe = tokens[4];
payS = tokens[5];

Employee emp = new Employee(id, name, dob, qual, expe, payS);

ArrayList list = new ArrayList();
list.add(emp);
line = br.readLine();
//

for (int i = 0; i < list.size(); i++) {
Employee p = (Employee) list.get(i);
if (eId.equals(p.getEmpId())) {
JOptionPane.showMessageDialog(null, "Employee : \n "
+ "Empoyee Id : " + p.getEmpId()
+ " \n Empoyee Name : " + p.getEmpName()
+ " \n DOB : " + p.getEmpDoB()
+ " \n Qualification : " + p.getEmpQualf()
+ " \n Experience : " + p.getEmpExp()
+ " \n DOB : " + p.getEmpPScale()
);
} else {
JOptionPane.showMessageDialog(null, "Employee Note found");
}
} // end for

}
br.close();
fr.close();

} catch (Exception ex) {
ex.printStackTrace();
}

}

public static void addEmployee() {
try {
ArrayList list = new ArrayList();

String id = JOptionPane.showInputDialog("Enter Id ");

String name = JOptionPane.showInputDialog("Enter Name ");
String dob = JOptionPane.showInputDialog("Enter DOB ");
String qualification = JOptionPane.showInputDialog("Enter Qualification ");
String experience = JOptionPane.showInputDialog("Enter Employee Experince in month ");
String paScale = JOptionPane.showInputDialog("Enter Emlpoyee pay scale ");

Employee emp = new Employee(id, name, dob, qualification, experience, paScale);
list.add(emp);

String line;
FileWriter fw = new FileWriter("empData.txt");
PrintWriter pw = new PrintWriter(fw);

for (int i = 0; i < list.size(); i++) {
emp = (Employee) list.get(i);
line = emp.getEmpId() + "," + emp.getEmpName() + "," + emp.getEmpDoB() + "," + emp.getEmpQualf() + "," + emp.getEmpExp() + "," + emp.getEmpPScale();
// writes line to file (empData.txt)
pw.println(line);
}
pw.flush();
pw.close();
fw.close();
} catch (IOException ioEx) {
System.out.println(ioEx);
}
}

}

Cs506 assignment no 1 solution fall 2021

Cs506 assignment no 1 solution fall 2021 Cs506 Web designing and development assignments solution

#CS506 #CS506assignment1solution2021
CS506 Assignment No.1 Fall 2021 100% Correct Complete Solution By Abid Farooq Bhutta

CS506 Assignment 1 Solution Fall 2021 By Abid Farooq Bhutta
CS506 Assignment No.1 Fall 2021 100% Correct Complete Solution By Abid Farooq Bhutta. CS506 Assignment 1 Complete Correct Solution Solved 2021 || Fall 2021 CS506 Solution Assignment No.1 2021 || Complete Correct Fall 2021 Solved. CS506 Assignment 1 Complete Solution Fall 2021, CS506 Assignment 1 Complete Solution, CS506 Assignment 1, CS506 , CS506 Assignment 1 solution, CS506 assignment Fall 2021, CS506 assignment solution Fall 2021, CS506 assignment, Assignment 1 CS506 solution, solution CS506 Assignment 1, CS506 Assignment 1 solution 2021, CS506 assignment solution 2021, CS506 Assignment 1, CS506 Assignment 1 solution Fall 2021, CS506 Assignment no 1 solution Fall 2021, CS506 Assignment no 1 solution 2021, CS506 2nd assignment solution 2021, CS506 1rd assignment solution, CS506 1rd assignment solution Fall 2021,assignment solution Fall 2021, #CS506 #CS506assignment1solution2021

RSS

© 2022   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service