-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSuper.java
46 lines (44 loc) · 956 Bytes
/
Super.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import java.util.*;
class Employee
{
int b,d,h;
void display()
{
System.out.println("Name of Class is Employee");
}
void calcSalary(int s,int a,int r)
{
b=s;
d=a;
h=r;
System.out.println("Gross Salary of Employee is "+(b+(b*d/100)+(b*h/100)));
}
}
class Engineer extends Employee
{ int b,d,h;
void calcSalary(int s,int a,int r)
{
super.display();
super.calcSalary(s,a,r);
b=s;
d=a;
h=r;
System.out.println("Name of Class is Engineer");
System.out.println("Gross Salary of Engineer is "+2*(b+(b*d/100)+(b*h/100)));
}
}
public class Super {
public static void main(String[] args)
{
Scanner in=new Scanner(System.in);
int bsa,da,hra;
Engineer ob=new Engineer();
System.out.println("Enter the basic salary of Employee");
bsa=in.nextInt();
System.out.println("Enter the DA of Employee");
da=in.nextInt();
System.out.println("Enter the HRA of Employee");
hra=in.nextInt();
ob.calcSalary(bsa,da,hra);
}
}