From 066e008adbdb3462eb67e5dc69e1738b71aecd2f Mon Sep 17 00:00:00 2001 From: Tonnes Date: Mon, 27 Jan 2025 13:00:21 +0100 Subject: [PATCH] Done --- Boolean.CSharp.Main/Core.cs | 9 ++++----- Boolean.CSharp.Main/Misc/Bicycle.cs | 5 +++++ Boolean.CSharp.Main/Misc/Car.cs | 5 +++++ Boolean.CSharp.Main/Misc/Motorbike.cs | 1 + Boolean.CSharp.Main/Misc/Unicycle.cs | 5 +++++ 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Boolean.CSharp.Main/Core.cs b/Boolean.CSharp.Main/Core.cs index e09c536..ecabcf2 100644 --- a/Boolean.CSharp.Main/Core.cs +++ b/Boolean.CSharp.Main/Core.cs @@ -42,11 +42,10 @@ Within the constructor the 'string Make' variable has scope within the construct //TODO: 1. Change car instantiation code above, pass in the make AND model. //TIP if you click on the Car class name above, right click and then select 'Go to Definition' it'll take you straight to the code - - + Car car1 = new Car("VW", "Bubble"); - return car; + return car1; } @@ -108,7 +107,7 @@ public Unicycle Question4() //TIP see we already have an internal member for the unicyclist name: _nameOfUnicyclist so you can use this to store the name internally // it is good practice to name internal class variable with an _ at the beginning - Unicycle unicycle = new Unicycle(); + Unicycle unicycle = new Unicycle("Timmy"); @@ -136,9 +135,9 @@ What are the parameters and types? //TODO: 5. Call the FlightDetails method that sets the cancelled message and cancel the flight //write code here + plane.FlightDetails("Flight cancelled!"); return plane; } - } } diff --git a/Boolean.CSharp.Main/Misc/Bicycle.cs b/Boolean.CSharp.Main/Misc/Bicycle.cs index f218c0e..388127a 100644 --- a/Boolean.CSharp.Main/Misc/Bicycle.cs +++ b/Boolean.CSharp.Main/Misc/Bicycle.cs @@ -10,6 +10,11 @@ public class Bicycle { private int _wheelCount; + public Bicycle() + { + _wheelCount = 2; + } + public int WheelCount { get; set; } } } diff --git a/Boolean.CSharp.Main/Misc/Car.cs b/Boolean.CSharp.Main/Misc/Car.cs index d810f5f..4f129ac 100644 --- a/Boolean.CSharp.Main/Misc/Car.cs +++ b/Boolean.CSharp.Main/Misc/Car.cs @@ -22,6 +22,11 @@ public Car(string Make) _make = Make; _model = string.Empty; } + public Car(string Make, string Model) + { + _make = Make; + _model = Model; + } public string Make { diff --git a/Boolean.CSharp.Main/Misc/Motorbike.cs b/Boolean.CSharp.Main/Misc/Motorbike.cs index 6fcf20b..700ad8a 100644 --- a/Boolean.CSharp.Main/Misc/Motorbike.cs +++ b/Boolean.CSharp.Main/Misc/Motorbike.cs @@ -22,6 +22,7 @@ public Motorbike() public Motorbike(string Make, string Model) { + _cc = 373; _make = Make; _model = Model; } diff --git a/Boolean.CSharp.Main/Misc/Unicycle.cs b/Boolean.CSharp.Main/Misc/Unicycle.cs index 461cb23..9fb80c1 100644 --- a/Boolean.CSharp.Main/Misc/Unicycle.cs +++ b/Boolean.CSharp.Main/Misc/Unicycle.cs @@ -10,6 +10,11 @@ public class Unicycle { private string _nameOfUnicyclist; + public Unicycle(string name) + { + _nameOfUnicyclist = name; + } + public string NameOfUnicyclist { get => _nameOfUnicyclist; set => _nameOfUnicyclist = value; } public int WheelCount { get; set; } = 1; }