write a class MyFlight, which implements the interface IFlight. The class MyFlight implements methods f1, f2 and f3 in IFlight as below (you can add other functions in MyFlight class):
f1: Sum of duration of flights that code does not start with 'V'.
f2: Sort the elements that the filght code does not end with a digit number in the list ascendingly by duration (other elements are unchanged).
f3: Remove all flights where the flight code does not end with a digit number and the flight duration is greater than the average duration of all flights in the list. (if there is no element that satisfies the conditions then do nothing). (Must ensure that the list is updated in-place and maintain its original order for the remaining elements)
When running, the program will add some data to the list. Sample output might look something like:
Add how many elements: 0
Add how many elements: 0
Enter TC(1-f1;2-f2;3-f3): 1
Enter TC(1-f1:2-f2;3-f3): 2
The list before running f2:
(A12,6) (B1X,9) (C34,2) (D2Y,29) (E67,22) (F,19)
4 of 4
Paper No: 3
The list before running f1:
(G1,12) (H,5)
OUTPUT:
(VN1,8) (VJ1,2) (FR1,16) (PJ1,17)
(A12,6) (H,5) (C34,2) (B1X,9) (E67,22) (F,19) (G1,12)
OUTPUT:33
+ 100%
(D2Y,29)
Zoom
Close