using System; namespace Game { /// /// Represents the armed forces for a country. /// public record ArmedForces { /// /// Gets the number of men and women in the army. /// public int Army { get; init; } /// /// Gets the number of men and women in the navy. /// public int Navy { get; init; } /// /// Gets the number of men and women in the air force. /// public int AirForce { get; init; } /// /// Gets the total number of troops in the armed forces. /// public int TotalTroops => Army + Navy + AirForce; /// /// Gets the number of men and women in the given branch. /// public int this[MilitaryBranch branch] => branch switch { MilitaryBranch.Army => Army, MilitaryBranch.Navy => Navy, MilitaryBranch.AirForce => AirForce, _ => throw new ArgumentException("INVALID BRANCH") }; } }