Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remote-control-competition: fix pre-filled stub #2399

Merged
merged 1 commit into from
Mar 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
public interface IRemoteControlCar
{
void Drive();
int DistanceTravelled { get; }
}
// TODO implement the IRemoteControlCar interface

public class ProductionRemoteControlCar : IRemoteControlCar, IComparable<ProductionRemoteControlCar>
public class ProductionRemoteControlCar
{
public int DistanceTravelled { get; private set; }
public int NumberOfVictories { get; set; }
Expand All @@ -13,16 +9,9 @@ public void Drive()
{
DistanceTravelled += 10;
}

public int CompareTo(ProductionRemoteControlCar? other)
{
if (ReferenceEquals(this, other)) return 0;
if (ReferenceEquals(null, other)) return 1;
return NumberOfVictories.CompareTo(other.NumberOfVictories);
}
}

public class ExperimentalRemoteControlCar : IRemoteControlCar
public class ExperimentalRemoteControlCar
{
public int DistanceTravelled { get; private set; }

Expand All @@ -36,14 +25,12 @@ public static class TestTrack
{
public static void Race(IRemoteControlCar car)
{
car.Drive();
throw new NotImplementedException($"Please implement the (static) TestTrack.Race() method");
}

public static List<ProductionRemoteControlCar> GetRankedCars(ProductionRemoteControlCar prc1,
ProductionRemoteControlCar prc2)
{
var rankings = new List<ProductionRemoteControlCar> { prc1, prc2 };
rankings.Sort();
return rankings;
throw new NotImplementedException($"Please implement the (static) TestTrack.GetRankedCars() method");
}
}
Loading