-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathusers.java
More file actions
122 lines (101 loc) · 2.56 KB
/
users.java
File metadata and controls
122 lines (101 loc) · 2.56 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
package project.pkg151;
import java.util.ArrayList;
import java.util.Scanner;
//////////////////////////
abstract public class users{
protected final String name;
protected int ID=1000;
protected static int count=0;
public users(String name) {
this.name = name;
this.ID +=++count;
}
public users() {
this("No name");
}
public String getName() {
return name;
}
public int getID() {
return ID;
}
@Override
public String toString() {
return "User{" + "name=" + name + ", ID=" + ID + '}';
}
}
//////////////////////////
class Employee extends users{
private double salary;
public Employee(String name,double salary) {
super(name);
this.salary = salary;
}
public Employee() {
this("",0);
}
public final String checkEmployee(){
if (super.getID() == 1001 ) {
return "Manager";
}
else
return "Normal";
}
@Override
public String getName() {
return name;
}
@Override
public int getID() {
return ID;
}
public final void UpdateSalary(int bounes )
{
salary = salary * bounes/100 + salary ;
}
public void setSalary(double Salary) {
this.salary = Salary;
}
public double getSalary() {
return salary;
}
@Override
public String toString() {
return "Employee (" + checkEmployee() + ")" + " name : " + name + " , ID :" + ID + " , Salary :" + salary + ')';
}
}
//////////////////////////
class customer extends users{
private int visit;
private String typecustmer;
public customer() {
this("");
}
public customer(String name) {
super(name);
}
public int getVisit() {
return visit;
}
public final String checkcustmer(){
if ( getVisit() > 2 )
return typecustmer = "special custmer";
else
return typecustmer = "new custmer";
}
public void setVisit(int visit) {
this.visit = visit;
}
@Override
public String getName() {
return name;
}
@Override
public int getID() {
return ID;
}
@Override
public String toString() {
return "customer{" +" name: "+getName()+" with ID: "+getID()+ "and time of visit= " + visit + '}';
}
}