Exemple #1
0
        static void Main(string[] args)
        {
            var ship = new TransportShip("shipz", 10);

            for (int i = 0; i < 4; i++)
            {
                var cargo = new TransportShip.Cargo("Bottles of Rum", 3);
                if (!ship.AddCargo(cargo))
                {
                    break;
                }
            }

            ship.ShowAvailableSpace();
            ship.ListCargo();
            var cargo2 = new TransportShip.Cargo("Bottles of Rum", 3);

            ship.RemoveCargo(cargo2);

            ship.ShowAvailableSpace();

            ship.ListCargo();

            var ship2 = new TransportShip("shipzor", 23);

            Console.WriteLine($"moving cargo from {ship.GetShipName()} to {ship2.GetShipName()}...");
            ship.MoveCargoToOtherShip(ship2);

            Console.WriteLine("Ship2 cargo..: ");
            ship2.ListCargo();
            ship2.ShowAvailableSpace();
            Map map = new Map();

            Console.ReadKey();
        }
Exemple #2
0
        static void Main(string[] args)
        {
            var ship = new TransportShip("Planet Express", 10);

            while (true)
            {
                var cargo = new Cargo("Bottles of Slurm", 3);

                if (!ship.AddCargo(cargo))
                {
                    break;
                }
            }

            Console.WriteLine($"{ship.Name}, space available: {ship.Available}");
            ship.ListCargo();

            ship.RemoveCargo();

            Console.WriteLine($"{ship.Name}, space available: {ship.Available}");
            ship.ListCargo();
        }