-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRoomTypeB.java
56 lines (50 loc) · 1.11 KB
/
RoomTypeB.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
package Hotel;
public class RoomTypeB extends RoomTypeA
{
private int discountperday;
public int getDiscountperday(){return discountperday;}
public void setDiscountperday(int a){discountperday=a;}
public double pricing()//õðåñêáëõøç ôçò pricing(å÷ïõìå õðïëïãéóìï ôïõ êïóôïõò ìå áöáéñåóç ôçò åêðôùóçò)
{
double sum=0;
double amount;
double cost;
int o=1;
for(i=0;i<=pd.length;i+=o)
{
try
{
if(pd[i]!=null)
{
o=pd[i].getResdays();
amount=this.getPriceperday();
cost = this.getPriceperday();
for(int k=1;k<o;k++)
{
if(cost>this.getPriceperday()/2)
{
cost=cost-this.getDiscountperday();
amount=amount+cost;
}
else
{
cost=this.getPriceperday()/2;
amount=amount+cost;
}
}
sum=+amount;
}
else
{
o=1;
}
}
catch(ArrayIndexOutOfBoundsException e){}
}
return sum;
}
public boolean cancel(int cd)//êáíåé õðåñêáëõøç ôçí cancel êáé äåí åðéôñåðåé ôçí áêõñùóç êñáôçóçò ãéá áõôï ôïí ôõðï äùìáôéïõ
{
return false;
}
}