-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathempSal.java
75 lines (72 loc) · 1.85 KB
/
empSal.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import java.util.Scanner;
class employee
{
String name;
int age,salary;
long phone_no;
String address;
Scanner sc=new Scanner(System.in);
void read()
{
System.out.println("enter the name of the employee");
name=sc.next();
System.out.println("enter the age of the employee");
age=sc.nextInt();
System.out.println("enter the phone number of the employee");
String str=sc.next();
phone_no=Long.parseLong(str);
System.out.println("enter the address of the employee");
address=sc.next();
System.out.println("enter the salary of the employee");
salary=sc.nextInt();
}
void display()
{
System.out.println("name of the employeeis: "+name);
System.out.println("age of the employee is: "+age);
System.out.println("phone number of the employee is:"+phone_no);
System.out.println("addressm of the employee is:"+address);
}
void print_salary()
{
System.out.println("Salary of the employee is: "+salary);
}
}
class officer extends employee
{
String spacialization;
void read_spec()
{
System.out.println("enter the spacialization");
spacialization=sc.next();
}
void print_spec()
{
System.out.println("the spacialization is: "+spacialization);
}
}
class manager extends employee
{
String spacialization;
void read_spec()
{
System.out.println("enter the spacialized course: ");
spacialization=sc.next();
}
void print_spec()
{
System.out.println("the spacialization is: "+spacialization);
}
}
class empSal
{
public static void main(String args[])
{
officer of=new officer();
of.read();
of.read_spec();
of.display();
of.print_spec();
of.print_salary();
}
}