-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakemytrip.dart
More file actions
68 lines (62 loc) · 2.11 KB
/
makemytrip.dart
File metadata and controls
68 lines (62 loc) · 2.11 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
class oneWay{
String? source, destination, departure_date;
int? noOfTravellers;
oneWay({this.source, this.destination, this.departure_date, this.noOfTravellers});
Map toMap(){
return{
'source':source,
'destination':destination,
'departure_date': departure_date,
'noOfTravellers':noOfTravellers
};
}
@override
String toString()
{
return{
'source':source,
'destination':destination,
'departure_date': departure_date,
'noOfTravellers':noOfTravellers
}.toString();
}
// void ShowOneWay()
// {
// print(" Source: ${source}\n Destination: ${destination} \n Departure Date: ${departure_date} \n No. of Travellers: ${noOfTravellers} ");
// }
}
class roundTrip extends oneWay{
String? returnDate;
roundTrip({source, destination, departure_date, noOfTravellers, this.returnDate}):super(source: source, destination: destination,departure_date: departure_date, noOfTravellers: noOfTravellers);
@override
String toString() {
// TODO: implement toString
String parentData=super.toString();
String myData={
'returnDate':returnDate
}.toString();
return parentData+myData;
}
// void ShowRoundTrip()
// {
// ShowOneWay();
// print("Return Date: ${returnDate}");
// }
}
class MultiCity extends oneWay{
int? noOfJourney;
MultiCity({source, destination, departure_date, noOfTravellers, this.noOfJourney}):super(source: source, destination: destination,departure_date: departure_date, noOfTravellers: noOfTravellers);
@override
String toString() {
// TODO: implement toString
String parentData=super.toString();
String myData={
'noOfJourney':noOfJourney
}.toString();
return parentData+myData;}
}
void main() {
// oneWay(source: "Delhi", destination: "Mumbai", departure_date: "24 July, 2021", noOfTravellers: 3).ShowOneWay();
print(roundTrip(source: "Delhi", destination: "Mumbai", departure_date: "24 July, 2021", noOfTravellers: 3, returnDate: "26 July, 2021"));
print(MultiCity(source: "Delhi", destination: "Mumbai", departure_date: "24 July, 2021", noOfTravellers: 3, noOfJourney: 1));
}