-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path7.java
More file actions
76 lines (74 loc) · 2.06 KB
/
7.java
File metadata and controls
76 lines (74 loc) · 2.06 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import java.util.*;
class Member{
String name,address;
int age;
float salary;
long phoneno;
void printsal()
{
System.out.println("The Member's salary is "+salary);
}
}
class Employee extends Member
{
String spel;
Employee(String n,String ad,int ag,float sal,long ph,String spe)
{
name=n;
address=ad;
age=ag;
salary=sal;
phoneno=ph;
spel=spe;
}
}
class Manager extends Member
{
String dept;
Manager(String n,String ad,int ag,float sal,long ph,String dep)
{
name=n;
address=ad;
age=ag;
salary=sal;
phoneno=ph;
dept=dep;
}
}
public class Main{
public static void main(String[] args)
{
Scanner sc = new Scanner (System.in);
System.out.println("Enter the Name of the Employee");
String n = sc.next();
System.out.println("Enter the age of the Employee");
int ag = sc.nextInt();
System.out.println("Enter the Phone number the Employee");
long ph = sc.nextLong();
System.out.println("Enter the address of the Employee");
String ad = sc.next();
System.out.println("Enter the salary of the Employee");
float sal = sc.nextFloat();
System.out.println("Enter the specialization of the Employee");
String spe = sc.next();
Employee ob = new Employee(n,ad,ag,sal,ph,spe);
System.out.println("Enter the Name of the Manager");
n = sc.next();
System.out.println("Enter the age of the Manager");
ag = sc.nextInt();
System.out.println("Enter the Phone number the Manager");
ph = sc.nextLong();
System.out.println("Enter the address of the Manager");
ad = sc.next();
System.out.println("Enter the salary of the Manager");
sal = sc.nextFloat();
System.out.println("Enter the department of the Manager");
spe = sc.next();
Manager ob1 = new Manager(n,ad,ag,sal,ph,spe);
System.out.println("NAME\tAGE\tPHONE NO\tADDRESS\tSPECIALIZATION\\DEPARTMENT");//optional i love aesthetics so tehee
System.out.println(ob.name+"\t"+ob.age+"\t"+ob.phoneno+"\t"+ob.address+"\t"+ob.spel);
System.out.println(ob1.name+"\t"+ob1.age+"\t"+ob1.phoneno+"\t"+ob1.address+"\t"+ob1.dept);
ob.printsal();
ob1.printsal();
}
}