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

Oop 3

SPPU SE IT OOP 3rd Practical

Uploaded by

dhonevaibhav785
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Oop 3

SPPU SE IT OOP 3rd Practical

Uploaded by

dhonevaibhav785
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Assignment No.

03

Name:
Roll.No.:

/* Design and develop inheritance for a given case study, identify objects and relationships and implement
inheritance wherever applicable. Employee class hasEmp_name, Emp_id, Address,Mail_id, and Mobile_nos
members. Inherit the classes: Programmer, Team Lead, Assistant Project Manager and Project Manager from
employee class. Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as DA, 10 % of
BP as HRA, 12% of BP as PF, 0.1% of BP for staff club fund. Generate pay slips for the employees with their
gross and net salary. */

Source Code :
class Employee {
String name, add, mail;
int mobile;
float id, basic;
void salary() {
float da, hra, pf, cf, gross;
da = 97/100*basic;
hra = 10/100*basic;
pf = 12/100*basic;
cf = basic*0.1f/100;
gross = basic + da + hra - pf - cf;
System.out.println("Name:" + name);
System.out.println("Address:"+add);
System.out.println("E_mail:"+ mail);
System.out.println("Mobile:"+mobile);
System.out.println("Emp_id:"+id);
System.out.println("Basic salary:" + basic);
System.out.println("Gross salary:" + gross);

}
}
class ProMan extends Employee {
ProMan(String name, String add, String mail,int mobile,float id,int sal) {
System.out.println("--Project Manager Salary Slip--");
this.name = name;
this.add=add;
this.mail=mail;
this.mobile=mobile;
this.id=id;
basic = sal;

}
}
class APM extends Employee {
APM(String name, String add, String mail,int mobile,float id,int sal){
System.out.println("--Assistant Project Manager Salary Slip--");
this.name = name;
this.add=add;
this.mail=mail;
this.mobile=mobile;
this.id=id;
basic = sal;
}
}

class TeamLead extends Employee {


TeamLead(String name, String add, String mail,int mobile,float id,int sal) {
System.out.println("--Team Leader Salary Slip--");
this.name = name;
this.add=add;
this.mail=mail;
this.mobile=mobile;
this.id=id;
basic = sal;
}
}

class programmer extends Employee {


programmer(String name, String add, String mail,int mobile,float id,int sal) {
System.out.println("--Programmer Salary Slip--");
this.name = name;
this.add=add;
this.mail=mail;
this.mobile=mobile;
this.id=id;
basic = sal;
}
}

class Inheritance{
public static void main(String[] args) {
ProMan p=new ProMan("Aman Kale","Pune","[email protected]",1234567891,101,60000);
p.salary();
APM a=new APM("Amar Date","Pune","[email protected]",321456987,102,50000);
a.salary();
TeamLead t=new TeamLead("Ram Rane","Mumbai","[email protected]",456789123,104,45000);
t.salary();
programmer r=new programmer("Radha Mane","Mumbai","[email protected]",894561236,104,55000);
r.salary();

}
}

Output :
--Project Manager Salary Slip--
Name:Aman Kale
Address:Pune
E_mail:[email protected]
Mobile:1234567891
Emp_id:101.0
Basic salary:60000.0
Gross salary:59940.0

--Assistant Project Manager Salary Slip--


Name:Amar Date
Address:Pune
E_mail:[email protected]
Mobile:321456987
Emp_id:102.0
Basic salary:50000.0
Gross salary:49950.0

--Team Leader Salary Slip--


Name:Ram Rane
Address:Mumbai
E_mail:[email protected]
Mobile:456789123
Emp_id:104.0
Basic salary:45000.0
Gross salary:44955.0

--Programmer Salary Slip--


Name:Radha Mane
Address:Mumbai
E_mail:[email protected]
Mobile:894561236
Emp_id:104.0
Basic salary:55000.0
Gross salary:54945.0

Process finished with exit code 0

You might also like