From 16fc35e161aa257a4f73e04429d468c690d4a43a Mon Sep 17 00:00:00 2001 From: smallbenji Date: Mon, 18 Aug 2025 10:33:44 +0200 Subject: [PATCH] Making sure it uses Microsoft Code Convention --- Animals/Elephant.cs | 2 +- Animals/Lion.cs | 4 ++-- Animals/Parrot.cs | 2 +- Figures/Circle.cs | 8 ++++---- Figures/Rectangle.cs | 12 ++++++------ Payment/PayPalPayment.cs | 2 +- Payment/Payment.cs | 2 +- RPG/Mage.cs | 6 +++--- RPG/Simulation.cs | 26 +++++++++++++------------- RPG/Warrior.cs | 8 ++++---- 10 files changed, 36 insertions(+), 36 deletions(-) diff --git a/Animals/Elephant.cs b/Animals/Elephant.cs index 7a3e42d..dafa744 100644 --- a/Animals/Elephant.cs +++ b/Animals/Elephant.cs @@ -6,7 +6,7 @@ namespace OOP.Animals { public Elephant() { - this.Name = this.GetType().Name; + Name = GetType().Name; } public override void MakeSound() diff --git a/Animals/Lion.cs b/Animals/Lion.cs index 85ba544..1a90df0 100644 --- a/Animals/Lion.cs +++ b/Animals/Lion.cs @@ -4,9 +4,9 @@ namespace OOP.Animals { public Lion() { - this.Name = this.GetType().Name; + Name = GetType().Name; } - + public override void MakeSound() { Console.WriteLine("Rawr"); diff --git a/Animals/Parrot.cs b/Animals/Parrot.cs index f0b6379..0d945a9 100644 --- a/Animals/Parrot.cs +++ b/Animals/Parrot.cs @@ -4,7 +4,7 @@ namespace OOP.Animals { public Parrot() { - this.Name = this.GetType().Name; + Name = GetType().Name; } public override void MakeSound() diff --git a/Figures/Circle.cs b/Figures/Circle.cs index d24f2cf..e913010 100644 --- a/Figures/Circle.cs +++ b/Figures/Circle.cs @@ -4,19 +4,19 @@ namespace OOP.Figures { public Circle(double radius) { - this.radius = radius; + Radius = radius; } - public double radius { get; set; } + public double Radius { get; set; } public override double GetArea() { - return Math.PI * Math.Pow(radius, 2); + return Math.PI * Math.Pow(Radius, 2); } public override double GetPerimeter() { - return 2 * Math.PI * radius; + return 2 * Math.PI * Radius; } } } \ No newline at end of file diff --git a/Figures/Rectangle.cs b/Figures/Rectangle.cs index 0eef9a7..836fc12 100644 --- a/Figures/Rectangle.cs +++ b/Figures/Rectangle.cs @@ -4,21 +4,21 @@ namespace OOP.Figures { public Rectangle(double width, double height) { - this.height = height; - this.width = width; + Height = height; + Width = width; } - public double height { get; set; } - public double width { get; set; } + public double Height { get; set; } + public double Width { get; set; } public override double GetArea() { - return height * width; + return Height * Width; } public override double GetPerimeter() { - return (height * 2) + (width * 2); + return (Height * 2) + (Width * 2); } } } \ No newline at end of file diff --git a/Payment/PayPalPayment.cs b/Payment/PayPalPayment.cs index 2160f7e..d525fc2 100644 --- a/Payment/PayPalPayment.cs +++ b/Payment/PayPalPayment.cs @@ -2,7 +2,7 @@ namespace OOP.Payment { public class PayPalPayment : GenericPayment { - public string email { get; set; } + public string Email { get; set; } public override void ProcessPayment() { diff --git a/Payment/Payment.cs b/Payment/Payment.cs index 59e801a..7f2b474 100644 --- a/Payment/Payment.cs +++ b/Payment/Payment.cs @@ -2,7 +2,7 @@ namespace OOP.Payment { public class GenericPayment { - public int amount { get; set; } + public int Amount { get; set; } public string Currency { get; set; } public virtual void ProcessPayment() diff --git a/RPG/Mage.cs b/RPG/Mage.cs index c629bed..cdc228a 100644 --- a/RPG/Mage.cs +++ b/RPG/Mage.cs @@ -2,12 +2,12 @@ namespace OOP.RPG { public class Mage : Character { - public Mage(int Mana) + public Mage(int mana) { - this.Mana = Mana; + Mana = mana; } - public int Mana = 10; + public int Mana { get; set; } = 10; public override int Attack() { diff --git a/RPG/Simulation.cs b/RPG/Simulation.cs index ce7baf0..e65db4c 100644 --- a/RPG/Simulation.cs +++ b/RPG/Simulation.cs @@ -4,36 +4,36 @@ namespace OOP.RPG { public Simulation(Character opponent1, Character opponent2) { - this.opponent1 = opponent1; - this.opponent2 = opponent2; + Opponent1 = opponent1; + Opponent2 = opponent2; } - public Character opponent1 { get; set; } - public Character opponent2 { get; set; } + public Character Opponent1 { get; set; } + public Character Opponent2 { get; set; } public void StartSimulation() { - while (!(opponent1.Health <= 0) && !(opponent2.Health <= 0)) + while (!(Opponent1.Health <= 0) && !(Opponent2.Health <= 0)) { // Attack opponent2 - var attack1 = opponent1.Attack(); - opponent2.Health -= attack1; + var attack1 = Opponent1.Attack(); + Opponent2.Health -= attack1; Console.WriteLine($"Opponent1 attacks Opponent2"); - Console.WriteLine($"Opponent1 attacks with {attack1} and Opponent2 has {opponent2.Health} left"); + Console.WriteLine($"Opponent1 attacks with {attack1} and Opponent2 has {Opponent2.Health} left"); - var attack2 = opponent2.Attack(); - opponent1.Health -= attack2; + var attack2 = Opponent2.Attack(); + Opponent1.Health -= attack2; Console.WriteLine($"Opponent2 attacks Opponent2"); - Console.WriteLine($"Opponent2 attacks with {attack2} and Opponent1 has {opponent1.Health} left"); + Console.WriteLine($"Opponent2 attacks with {attack2} and Opponent1 has {Opponent1.Health} left"); } - if (opponent1.Health <= 0) + if (Opponent1.Health <= 0) { Console.WriteLine("Opponent2 wins"); } - if (opponent2.Health <= 0) + if (Opponent2.Health <= 0) { Console.WriteLine("Opponent1 wins"); } diff --git a/RPG/Warrior.cs b/RPG/Warrior.cs index 9ff1050..cff08c9 100644 --- a/RPG/Warrior.cs +++ b/RPG/Warrior.cs @@ -4,16 +4,16 @@ namespace OOP.RPG { public Warrior(int strength) { - this.strength = strength; + Strength = strength; } - public int strength = 10; + public int Strength { get; set; } = 10; - public int multiplier = 2; + public int Multiplier { get; set; } = 2; public override int Attack() { - return base.Attack() * multiplier; + return base.Attack() * Multiplier; } } } \ No newline at end of file