// called in BuyShip(). private void ShipSelector() { try { int option = int.Parse(Console.ReadLine()); // case for helium balloon. if (option == 1 && MyShip.GetCredits() >= 10) { // ensures that current cargo weight is not greater than the amount that the purchased ship can hold. if (MyShip.GetCargoWeight() > 200) { Console.WriteLine(); Console.WriteLine("You have more cargo than this ship can hold. Go sell some stuff and try again."); Console.WriteLine(); } else { // sets MyShip's fields. MyShip.ChangeFuelCapacity(5); MyShip.ChangeFuel(5); MyShip.ChangeCargoCapacity(200); MyShip.ChangeCredits(-10); MyShip.ChangeShipName("A helium baloon"); Console.Clear(); Console.WriteLine("You are now the proud owner of a helium balloon."); Console.WriteLine(); } } else if (option == 2 && MyShip.GetCredits() >= 4200) { if (MyShip.GetCargoWeight() > 3000) { Console.WriteLine(); Console.WriteLine("You have more cargo than this ship can hold. Go sell some stuff and try again."); Console.WriteLine(); } else { MyShip.ChangeFuelCapacity(350); MyShip.ChangeFuel(1000); MyShip.ChangeCargoCapacity(3000); MyShip.ChangeCredits(-4200); MyShip.ChangeShipName("Reasonable Rocketship"); Console.Clear(); Console.WriteLine("Welcome aboard the Reasonable Rocketship. You got a great deal."); Console.WriteLine(); } } else if (option == 3 && MyShip.GetCredits() >= 25000) { if (MyShip.GetCargoWeight() > 20000) { Console.WriteLine(); Console.WriteLine("You have more cargo than this ship can hold. Go sell some stuff and try again."); Console.WriteLine(); } else { MyShip.ChangeFuelCapacity(50000); MyShip.ChangeFuel(50000); MyShip.ChangeCargoCapacity(20000); MyShip.ChangeCredits(-25000); MyShip.ChangeShipName("Malaysia Airlines Flight 370"); Console.Clear(); Console.WriteLine("You are now Captain of Malaysia Airlines Flight 370. Don't travel to year 2014. They're looking for you there."); Console.WriteLine(); } } else { MainError(); } } catch (Exception) { MainError(); } }