時は金なりという意味か?
public class Person { BasicInfo info; float stock; float Value; public string Name(bool isSpy){ return isSpy ? info.Name : info.Name.ToSecondName(); } public string Sex(bool isNormal){ return isNormal == info.isMan ? "Man" : "Woman"; } public float Earn(bool isExtra = false){ float sexPad = info.isMan ? 1f : 0.5f; float racePad = info.isWhite ? 1f : 0.5f; var delta = DateTime.Now - info.Birth; int age = (int)(delta.TotalDays / 365); float result = Value * sexPad * racePad * age; if(isExtra){ Value += result; } return result; } enum Race{ White, Black, Yellow }; class BasicInfo{ public string Name; public int NationalId; public bool isWhite; public bool isMan; public DateTime Birth; public BasicInfo(string Name, int NationalId, Race race, bool isMan){ this.Name = Name; this.NationalId = NationalId; this.isWhite = race == Race.White; this.isMan = isMan; Birth = DateTime.Now; } }