CS506 Assignment 3 Fall 2023 – Assignments – Solution VU
CS506 Assignment 3 Fall 2023 – Assignments – Solution VU
Assignment No. 03 CS506 – Web Design and Development |
Total Marks: 20 Due Date: 10/2/2023 |
Please read the following instructions carefully before solving & submitting assignment:
Uploading Instructions:
- Use NetBeans IDE for this assignment development.
- After finalizing, compress all files with Zip or RAR format.
- Rename it to your own Student Id (g. bc000000000.rar).
- And submit at VU-LMS within due date.
Rules for Marking:
It should be clear that your assignment will not get any credit if:
- Provided Student ID is wrong.
- Any other software/IDE (except NetBeans IDE) is used for assignment development.
- Assignment is not submitted in .zip/.rar format.
- Assignment is submitted after due date or via email.
- Submitted assignment does not open or file is corrupted.
- Assignment is fully or partially copied from other student or ditto copy from handouts or Internet. Strict disciplinary action will be taken in this case.
- Submitted code is unable to compile/execute in NetBeans IDE during evaluation, submitted code will be checked on NetBeans IDE. If unable to execute then ZERO marks will be awarded and no excuses will be accepted in this regard.
Note: Do not put any query on MDB regarding this assignment, if you have any query then email at [email protected]
Lectures Covered: This assignment covers Lecture # 24 – 30
GOOD LUCK
Problem Statement:
Accounts Department of an ABC organization wants to develop a web application named Employee Salary System (ESS) using Apache Tomcat Server to facilitate its employees regarding their salaries status and to get salary in chunks (if any employee wants to take this facility). This application will work like a bank account where employee could see his/her complete employee details (employee id, employee name, salary per month, current balance). Also, employee can withdraw salary in chunks of 1000 Rs (that will be provided to employee in cash from accounts department). Now you are required to follow following requirements to build this web application.
Detailed Description:
The ESS application will facilitate the employees of the organization. Therefore, you are required to develop an html page named (index.html) which will contain login form as shown in Figure 1.
“LOGIN” button will be used to login the application while “Clear” button will clear credential values. Employees can see the ESS dashboard (see Fig 2) by successful login to the application using employee id (should be your own VU Student ID) and password (should be 1244). For this purpose, write a Java Servlet named LoginSvlt.java that will receive submitted information through login page (index.html) and verify login credential values from the database i.e. weather entered credentials are correct or not. If incorrect credentials are used to login then it should print a message “Invalid Employee ID or Password” as shown in figure 1.1.
If employee credentials (i.e. employee id and password) are correct, then ESS dashboard page will open (i.e. EmpServicesSvlt.java) which will show the following features to the employee in dashboard (see Fig 2).
- View Salary
- Withdraw Salary
- Logout System
- View Salary:
When employee click on View button on ESS Dashboard it will show following features by fetching updated data from the database
- Employee details
- Employee ID = your own VU Student ID (e.g. BC124456789)
- Name = your name as given on VULMS
- Salary per Month = 30000
- Current salary balance = Total salary – Sum of salary withdrawn yet
E.g. Total salary is 30,000 and employee performed three withdrawals then current balance will be as given: Current balance = 30000 – (1000+1000+1000) = 27000
- Employee current Salary Balance
- Withdraw salary message
- Two buttons with labels “YES” or “NO”.
Fig. 3: View Salary (ViewSalSvlt.java)
- Withdraw Salary:
When employee click on Withdraw button on ESS dashboard then application will show withdraw features (using WithdrawSalSvlt.java) as shown in Fig 4.
Employee can withdraw salary which is multiple of Rs. 1000/- and maximum of Rs. 30000/- .Hint is given below:
Hint:
if (salary % 1000 == 0)
// it is a multiple of 1000.
If salary Current Balance is zero and Amount of Withdraw entered is grater then current balance, then following message should display as shown in Fig 4.1.
Otherwise amount of Withdrawal is deducted from salary Current Balance and update database after each withdrawal and successful salary withdrawal message should appear as given in the Fig 4.2.
- Logout:
When employee click on Logout button on ESS Dashboard then application will show “Thank You” message (using EmpServicesSvlt.java) as shown in Fig 5.
Note:
On clicking “YES” button on different screenshots salary withdraw page will get open (see Fig 4). While on clicking “No” button ESS Dashboard will get open (see Fig 2).
Required Stuff:
HTML Pages:index.html
Java Classes:
Employee.java:
Attributes:
-
id: int
-
empName: String
-
empID: String
-
empPass: int
-
empSalary: int
Methods:
-
Constructors: Default and parameterized Constructor
-
Setter Methods: setID(…), setEmpName(…), setEmpID(…), setEmpPass(…), setEmpSalary(…)
-
Getter Methods: getID(), getEmpName(), getEmpID(), getEmpPass(), getEmpSalary()
EmpACManager.java: (should contain employee salary transactions related code)
Attributes:
Methods:
-
initDatabaseHelper(…), getEmpDetail(), isValidEmployee(…), withdrawSalary(…), getSalMaxLimit()
DatabaseHelper.java: (Should contain database related code)
Attributes:
-
PATH: String
-
FILE: String
Methods:
Java Servlets:
LoginSvlt.java:
Methods:
-
init(), processRequest(…), initServicesSvlt(…) , showLoginErrorPage(…)
EmpServicesSvlt.java:
Methods:
-
processRequest(…), initWithdrawSalSvlt(…), initViewSalSvlt(…), updateServices(…), initEmpLogout(…)
ViewSalSvlt.java:
Methods:
WithdrawSalSvlt.java:
Methods:
Database File:
BC124456789.accdb (must be same as Your Own VU Student ID) and must be in Assets folder.
Fig. 7: Folder “assets” under web directory
Sample Data:
ID |
Employee Name |
Employee ID |
Employee Pass |
Employee Salary |
1 |
Muhammad Bilal |
BC124456789 |
1244 |
30,000 |
Tab. 1: Sample Employee Data (Should Contain Your Name and Student ID as Employee ID)
Tab. 2: Employees Table in MS Access Database file
Video Tutorials:
- To download and install Tomcat Server, please watch;
https://vulms.vu.edu.pk/Courses/CS506/Downloads/Tomcat_Server_Installation.mp4
- To create a web application project in NetBeans IDE, please watch.
https://vulms.vu.edu.pk/Courses/CS506/Downloads/Web_Application_in_Netbeans.mp4
- To add ucanaccess driver in a NetBeans project, please watch;
https://vulms.vu.edu.pk/Courses/CS506/Downloads/UCanAccess_Driver_Installation.mp4
Important Things to Implement:
- You must provide separate html pages, servlets and Java classes as guided above. Merging of two or more will result in deduction of marks.
- You need to put database file in assets folder under NetBeans IDE project web directory along with html pages, as shown in Fig 7.
- For storing/fetching data to/from database, you will need to use proper SQL queries.
- Java classes must have proper Data Members and Member Functions along with Constructors, Standard Setters and Getters etc.
- Need to make sure that exceptions are managed properly throughout the program; especially NullPointerException, ClassNotFoundException, NumberFormatException and SQLException etc.
- All images, tables, and sample data given in this document are just for reference purpose only; you need to provide your own impleentations. It is not required to be the same.
Good Luck
Students kindly share assignment files in relevant subject timely for discussion/solution.
or directly share with us ” Click here“
QueryVU WhatsApp groups subject wise Join Now
#CS506 #Assignment #Fall #Assignments #Query