-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest2.java
60 lines (57 loc) · 1.46 KB
/
test2.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*class Person
{
private String name;
private long adhar;
public Person(String name,long adhar)
{
this.name=name;
this.adhar=adhar;
}
public void print()
{
System.out.println("Name: "+name);
System.out.println("Adhar no: "+adhar);
}
}
class Employee extends Person
{
public double salary;
public Employee(String name,long adhar,double salary)
{
super(name,adhar);
this.salary=salary;
}
public void print()
{
super.print();
System.out.println("Salary"+salary);
}
}
class ContactEmployee extends Employee
{
final private static double hourlyPay=100.00;
private int contactHour;
public ContactEmployee(String name,long adhar,int contactHour)
{
super(name,adhar,contactHour*hourlyPay);
this.contactHour=contactHour;
}
}
public class test2{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String nm1 = sc.nextLine();
String nm2 = sc.nextLine();
long adh1 = sc.nextLong();
long adh2 = sc.nextLong();
double sal = sc.nextDouble();
int cont = sc.nextInt();
Employee[] eArr = new Employee[2];
eArr[0] = new Employee(nm1, adh1, sal);
eArr[1] = new ContactEmployee(nm2, adh2, cont);
sc.close();
for(Employee e : eArr)
e.print();
}
}
*/