-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMisthotos.java
64 lines (52 loc) · 1.49 KB
/
Misthotos.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
package excerise;
public class Misthotos extends Employee implements iMisthotos {
private double akatharistos;
private double kratiseis;
private double bonus_paidion;
private boolean bonus;
public Misthotos(boolean bonus,String eponymia, int payType,double a,double k,double b) throws PayTypeExceptionMisthotos, PayTypeExceptionOromisthios {
super(eponymia, payType);
if (payType!=0) {
throw new PayTypeExceptionMisthotos("For input type-misthotos "+payType+" wrong input (0-Misthoto,1-Oromisthio), please try again:");
}
this.bonus=bonus;
akatharistos=a;
kratiseis=k;
bonus_paidion=b;
}
public boolean getBonus() throws BonusException {
if (bonus) {
throw new BonusException("Bonus:0");
}
return bonus;
}
public double getBonusPaidion() {
return bonus_paidion;
}
public double getAkatharistos() {
return akatharistos;
}
public double getKratiseis() {
return kratiseis;
}
@Override
public void Katharos_Misthtou() {
double v=akatharistos-kratiseis;
try {
getBonus();
System.out.println("Misthos:"+(v+getBonusPaidion()));
}catch(BonusException e1) {
System.out.println(e1.getMessage()+" Misthos:"+v);
}
}
@Override
public String getPayType() {
if (getPType()==0) {
return "misthotos";
}
return "-1";
}
public String toString(){
return getEponymia()+" "+getPType()+" "+getPayType()+" "+getAkatharistos()+" "+getKratiseis()+" "+getBonusPaidion()+" ";
}
}