private void OpSellItem(int itemId) { Console.WriteLine("How many would you like to sell?"); int quantity = SetQuantity(); switch (itemId) { // case to sell pizza case 3: if (MyShip.GetItemQuant(itemId) >= quantity) { // enforces unique economy MyShip.ChangeCredits(MyShip.GetPrice(0) * quantity); // adds to lifetime earnings to be displayed at end of game MyShip.ChangeTotalEarned(MyShip.GetPrice(0) * quantity); // removes sold item(s) from cargo inventory MyShip.ChangeItem(3, -quantity); // removes weight from cargo MyShip.ChangeWeight(150 * -quantity); Console.Clear(); Console.WriteLine($"Item sold. Credits = {MyShip.GetCredits()}"); } else { SellError(); } break; // case to sell Op1Item item. See above for general case statement notes. case 4: if (MyShip.GetItemQuant(itemId) >= quantity) { MyShip.ChangeCredits(MyShip.GetPrice(-1) * quantity); MyShip.ChangeTotalEarned(MyShip.GetPrice(-1) * quantity); MyShip.ChangeItem(4, -quantity); MyShip.ChangeWeight(150 * -quantity); Console.Clear(); Console.WriteLine($"Item sold. Credits = {MyShip.GetCredits()}"); } else { SellError(); } break; case 5: if (MyShip.GetItemQuant(itemId) >= quantity) { MyShip.ChangeCredits(MyShip.GetPrice(1) * quantity); MyShip.ChangeTotalEarned(MyShip.GetPrice(1) * quantity); MyShip.ChangeItem(5, -quantity); MyShip.ChangeWeight(150 * -quantity); Console.Clear(); Console.WriteLine($"Item sold. Credits = {MyShip.GetCredits()}"); } else { SellError(); } break; case 6: if (MyShip.GetItemQuant(itemId) >= quantity) { MyShip.ChangeCredits(MyShip.GetPrice(1) * quantity); MyShip.ChangeTotalEarned(MyShip.GetPrice(1) * quantity); MyShip.ChangeItem(6, -quantity); MyShip.ChangeWeight(150 * -quantity); Console.Clear(); Console.WriteLine($"Item sold. Credits = {MyShip.GetCredits()}"); } else { SellError(); } break; case 7: if (MyShip.GetItemQuant(itemId) >= quantity) { MyShip.ChangeCredits(MyShip.GetPrice(1) * quantity); MyShip.ChangeTotalEarned(MyShip.GetPrice(1) * quantity); MyShip.ChangeItem(7, -quantity); MyShip.ChangeWeight(150 * -quantity); Console.Clear(); Console.WriteLine($"Item sold. Credits = {MyShip.GetCredits()}"); } else { SellError(); } break; default: TradeError(); break; } }