loading...

CS508 Assignment 2 Solution Fall 2017

Question No 1:
Suppose a textile company “Grace Textile” human resource (HR) department. It has total 80
employees in 3 different branches. Employees are of 3 categories: Internees, Contract and Permanent
employees. Internees have internship of 6 months with fixed salary i.e, 20 thousand. Salaries are
calculated on basis of grades. Both contract and permanent employees have different pay scales.
Permanent employees also got benefits of pension and gratuity .Contract employees get monthly
salary and an annual additional bonus.
You are required to write a Java program comprising :
 Three Classes Employee, Contract Employee, Permanent Employee
 Employee class will have basic attributes of “Employee Id”, CNIC, Name, Grade, Salary and
Category (Internee, Contract, and Permanent). Use “I” for internee, “C” for “Contract” and
“P” for permanent
 CNIC will be of format 123-456-789
 Contract Employee class will have attributes/data members of Employee class and an
additional member “Bonus”
 Permanent Employee class will have attributes of Employee class along with 2 additional
attributes “Gratuity” and “Pension”
 Use proper data types for all data members
 Write display message of base class and derived classes which will print Emp Id of respective
class
 Write a function for Contract Employee Class that will calculate bonus. Roll number will be
stored in an array. Roll number will be your own vu id only digits (8 digits excluding first 2
characters). E.g, If your Roll number is BC12345678, 12345678 will be stored in array. Add
all 8 digits and name it “sum
”. Calculate bonus with formula: (sum*1000)/2; Print value of
bonus.
Steps to Compile /Execute Java Program:

Open following link :
http://www.compileonline.com/compile_java8_online.php
Here you can compile and execute your Java Code with(JDK 1.8.0)*.
1. Paste/replace your code
2.
 “Execute” program
3. Take screen shot of code plus result
4. Copy it in .doc file
5. Your assignment should be in .doc or .docx format
Hints: You will use inheritance and overriding for display function.

DOWNLOAD SOLUTION HERE
loading...