public static List <Student> Enter(out byte temp) { Console.WriteLine("Hello, unfortunately you ended up in the wrong place and consciousness."); Console.WriteLine("What is your name?"); string name = Console.ReadLine(); List <Student> students = new List <Student>() { new BusinessStudent(name, 10000, 50), new SportStudent(name, "Football"), new ItStudent(name, "C#") }; Console.WriteLine("What type of student are you? (1.Business 2.Sport 3.IT)"); temp = Validation.DefaultValidation(); students[temp - 1].Info(name); Console.WriteLine("Do you want to add some money for good start :D? Yes(1)/No(0)"); if (Validation.CheckInput() == 1) { bool checkMoney = Int32.TryParse(Console.ReadLine(), out int cheat); while (!checkMoney) { Console.WriteLine("Wrong input, please try again."); checkMoney = Int32.TryParse(Console.ReadLine(), out cheat); } students[temp - 1].Money = cheat; } return(students); }
public override void NightClub() { Console.WriteLine("1.Employees (150 mon.)" + "2.Space (250 mon.)" + "3.Withdraw Cash" + "0.Exit"); switch (Validation.DefaultValidation()) { case 1: { Console.WriteLine("Employees: " + employeesCount); Console.WriteLine("How many employees do you want to buy? "); byte temp = Validation.DefaultValidation(); if ((employeesCount + temp) > spaceCount * 2) { Console.WriteLine("You should buy more space for employees!"); } else { money -= temp * 150; employeesCount += temp; } } break; case 2: { Console.WriteLine("Space: " + spaceCount); Console.WriteLine("How many space do you want to buy? "); byte temp = Validation.DefaultValidation(); if ((money - temp * 250) < -100) { Console.WriteLine("You can't buy such amount of space because you lose this game!"); } else { money -= temp * 150; spaceCount += temp; } } break; case 3: { money += cashOfBusiness; cashOfBusiness = 0; } break; case 0: break; default: Console.WriteLine("Enter digit in the border of menu."); break; } }
public override void Tournament(byte i) { Random rnd = new Random(); switch (i) { case (byte)Competition.Amateur: { int comp = rnd.Next(0, 50); if (comp >= 25 && strength > 25) { Console.WriteLine("Congratulations! You have won Amateur tournament in " + this.TypeOfSection); strength = 0; popularity += 50; } else { Console.WriteLine("Don't worry, you can be better the next time!"); } } break; case (byte)Competition.Professional: { int comp = rnd.Next(0, 50); if (comp >= 42 && strength > 100) { Console.WriteLine("Congratulations! You have won Professional tournament in " + this.TypeOfSection); strength = 0; popularity += 100; } else { Console.WriteLine("Maybe you aren't too strong for that competition..."); } } break; case (byte)Competition.Olympiad: { int comp = rnd.Next(0, 50); if (comp >= 49 && strength > 250) { Console.WriteLine("Congratulations! You have won Professional tournament in " + this.TypeOfSection); strength = 0; popularity += 1500; } } break; case (byte)Competition.Prepearing: Sport(Validation.DefaultValidation()); break; } }
public override void ComputerShopping() { Console.WriteLine("1.MicroProcessor(150 mon.)\n" + "2.VideoCard(200mon.)\n" + "3.RAM(120mon.)\n" + "4.HDD(100mon.)\n"); byte i = Validation.CheckInput(); Console.WriteLine("How much strength do you want to add?"); int temp = Validation.DefaultValidation(); switch (i) { case (byte)Accessories.Microprocessor: { microProcessor += temp; money -= temp * 150; } break; case (byte)Accessories.Videocard: { videoCard += temp; money -= temp * 200; } break; case (byte)Accessories.RAM: { RAM += temp; money -= 120 * temp; } break; case (byte)Accessories.HDD: { HDD += temp; money -= 100 * temp; } break; default: Console.WriteLine("You wrote wrong symbol"); break; } computerStrength += ((microProcessor + videoCard + RAM + HDD) * 0.4); }
public override byte HeadMenu() { base.HeadMenu(); Console.WriteLine("Computer Upgrade(9):"); return(Validation.DefaultValidation()); }
public override byte HeadMenu() { base.HeadMenu(); Console.WriteLine("Business(9):"); return(Validation.DefaultValidation()); }
static void Main(string[] args) { BusinessStudent firstStud = new BusinessStudent("Alexey", 10000, 50); Student secondStud = new SportStudent("Valeriy", 5000, 15); firstStud.SmartCompare(firstStud, secondStud); firstStud.MoneyCompare(firstStud, secondStud); List <Student> students = new List <Student>() { new SportStudent("Ivan", "Rugby") }; students[0].Money = 15000; students[0].EducationLevel = 25; students[0].Hp = 15; Console.WriteLine("Do you want to change your profession? Yes(1)/No(0)"); if (Validation.DefaultValidation() == 1) { Console.WriteLine("What type of student you want to be? \n" + " 1.Businessman" + " 2.Sport" + " 3.IT"); switch (Validation.DefaultValidation()) { case (byte)Character.Business: { if (!(students[0] is BusinessStudent)) { Student newStudent = new BusinessStudent(students[0].Name); newStudent = (Student)students[0].Clone(); students.Remove(students[0]); students.Add(newStudent); } else { Console.WriteLine("You can't be changed from Business to Business."); } } break; case (byte)Character.Sport: { if (!(students[0] is SportStudent)) { Student newStudent = new BusinessStudent(students[0].Name); newStudent = (Student)students[0].Clone(); students.Remove(students[0]); students.Add(newStudent); } else { Console.WriteLine("You can't be changed from Sport to Sport."); } } break; case (byte)Character.IT: { if (!(students[0] is ItStudent)) { Student newStudent = new BusinessStudent(students[0].Name); newStudent = (Student)students[0].Clone(); students.Remove(students[0]); students.Add(newStudent); } else { Console.WriteLine("You can't be changed from IT to IT."); } } break; } } List <Student> studentsList = new List <Student>() { new BusinessStudent("Alexey", 10000, 50), new SportStudent("Valeriy", 5000, 15), new ItStudent("Grigoriy", 25000, 100) }; studentsList.Sort(); foreach (Student stud in studentsList) { Console.WriteLine(stud.Name); } }