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.

Lectures Covered : 27-30

The objective of this assignment is to enhance knowledge of Java Programming:
1. It will increase learning of Java data types, classes concepts
2. Hand on experience of arrays
3. Students will be able to implement Inheritance and Over riding

Please read the following instructions carefully before solving & submitting the assignment:
1. The assignment will not be accepted after due date.
2. Zero marks will be awarded to the assignment that does not open or the file is
3. The assignment file must be MS Word (.doc) file format; Assignment will not be
accepted in any other format.
4. Zero marks will be awarded to the assignment if copied (from other student or copied
from handouts or internet).
5. Zero marks will be awarded to the assignment if the Student ID is not mentioned in
the assignment file.
Note: All types of plagiarism are strictly prohibited. Copy cases will be awarded
zero marks.

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
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
Steps to Compile /Execute Java Program:

Open following link :
Here you can compile and execute your Java Code with(JDK 1.8.0)*.
1. Paste/replace your code
“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.

Views: 3446


Replies to This Discussion

plz start disscution about Assignment # 2.....

sub soo rahey hi kiya

koi idea

today last day

sab so rhy hain yahan

ap ne khud try kia ?

public class Employee
private int id;
private int cnic;
private String name;
private int grade;
private int salary;
private String categ;

public Employee( int employeeId, int employeeCnic, String employeeName, int employeeGrade, int employeeSalary, String employeeCateg)
id = employeeId;
cnic = employeeCnic;
name = employeeName;
grade = employeeGrade;
salary = employeeSalary;
categ = employeeCateg;

System.out.println("Enter ID of the Employee:");
id = get.nextLine();
System.out.println("Enter CNIC of the Employee:");
cnic = get.nextLine();
System.out.println("Enter Name of the Employee:");
name = get.nextLine();
System.out.println("Enter Grade:");
grade = get.nextInt();
System.out.println("Enter Salary of the Employee:");
salary = get.nextLine();
System.out.println("Enter Category of the Employee (I, C, P):");
categ = get.nextLine();
void display()
System.out.println("Employee ID: "+ id);
System.out.println("Employee CNIC: "+ cnic);
System.out.println("Employee Name: "+ name);
System.out.println("Grade: "+ grade);
System.out.println("Salary: "+ salary);
System.out.println("Category: "+ categ);
class contractEmployee extends Employee
int bonus;
System.out.println("Enter Grade: ");
grade = get.nextInt();
System.out.println("Enter Salary:");
salary = get.nextFloat();
void display()
System.out.println("=============================="+"\n"+"Full Time Employee Details"+"\n"+"=============================="+"\n");
System.out.println("Salary: "+salary);
System.out.println("Designation: "+ grade);
class permanentEmployee extends Employee
int gratuatiy, pension;
System.out.println("Enter Number of Working Hours:");
gratuatiy = get.nextInt();
void calculatepay()
pension = ;

void display()
System.out.println("=============================="+"\n"+"Part Time Employee Details"+"\n"+"=============================="+"\n");
System.out.println("Number of Working Hours: "+pension);
System.out.println("Salary for "+gratuatiy+" working hours is: $"+pension);

class Employee
public static void main(String args[])
System.out.println("================================"+"\n"+"Enter Full Time Employee Details"+"\n"+"================================"+"\n");
permanentEmployee ob1 = new permanentEmployee();
contractEmployee ob = new contractEmployee();
System.out.println("================================"+"\n"+"Enter Part Time Employee Details"+"\n"+"================================"+"\n");

} error: illegal start of expression
pension = ;

same error

Bhai logo es code ko likny k ly java install kro ya visual studio plz reply fast

kuch bi install krny ki zarort nai hy bas jo assignment ma link diya hua us ma code likho r run kro

thanx  ROMEO

any solution about this error.


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

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