-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInternationalTrip.java
More file actions
34 lines (22 loc) · 1.02 KB
/
Copy pathInternationalTrip.java
File metadata and controls
34 lines (22 loc) · 1.02 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
public class InternationalTrip extends Trip{
private boolean passportRequired;
private String currency;
public InternationalTrip(String destination, int days, boolean passportRequired, String currency){
super(destination,days);
this.passportRequired = passportRequired;
this.currency = currency;
}
public String toString(){
return super.toString() + " \nPassport Required : " + passportRequired +
"\n Currency " + currency;
}
public boolean equals(InternationalTrip other){
return super.equals(other) && this.passportRequired == other.passportRequired &&
this.currency.equals(other.currency) ;
}
public InternationalTrip extend(Trip other){
String newDestination = getDestination() + "&" + other.getDestination();
int newDays = this.getDays() + other.getDays();
return new InternationalTrip(newDestination, newDays, this.passportRequired,this.currency);
}
}