1- public interface IRemoteControlCar
2- {
3- void Drive ( ) ;
4- int DistanceTravelled { get ; }
5- }
1+ // TODO implement the IRemoteControlCar interface
62
7- public class ProductionRemoteControlCar : IRemoteControlCar , IComparable < ProductionRemoteControlCar >
3+ public class ProductionRemoteControlCar
84{
95 public int DistanceTravelled { get ; private set ; }
106 public int NumberOfVictories { get ; set ; }
@@ -13,16 +9,9 @@ public void Drive()
139 {
1410 DistanceTravelled += 10 ;
1511 }
16-
17- public int CompareTo ( ProductionRemoteControlCar ? other )
18- {
19- if ( ReferenceEquals ( this , other ) ) return 0 ;
20- if ( ReferenceEquals ( null , other ) ) return 1 ;
21- return NumberOfVictories . CompareTo ( other . NumberOfVictories ) ;
22- }
2312}
2413
25- public class ExperimentalRemoteControlCar : IRemoteControlCar
14+ public class ExperimentalRemoteControlCar
2615{
2716 public int DistanceTravelled { get ; private set ; }
2817
@@ -36,14 +25,12 @@ public static class TestTrack
3625{
3726 public static void Race ( IRemoteControlCar car )
3827 {
39- car . Drive ( ) ;
28+ throw new NotImplementedException ( $ "Please implement the (static) TestTrack.Race() method" ) ;
4029 }
4130
4231 public static List < ProductionRemoteControlCar > GetRankedCars ( ProductionRemoteControlCar prc1 ,
4332 ProductionRemoteControlCar prc2 )
4433 {
45- var rankings = new List < ProductionRemoteControlCar > { prc1 , prc2 } ;
46- rankings . Sort ( ) ;
47- return rankings ;
34+ throw new NotImplementedException ( $ "Please implement the (static) TestTrack.GetRankedCars() method") ;
4835 }
4936}
0 commit comments