Example #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();
        }
Example #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();
        }
Example #3
0
        static void Main(string[] args)
        {
            //var express = new TransportShip("Planet Express", 10);

            ////var nostromo = new TransportShip("Nostromo", 50);

            //express.AddCargo(new Cargo("Item A", 1));
            //express.AddCargo(new Cargo("Item B", 1));

            //Cargo cargo;

            //while ((cargo = express.RemoveCargo()) != null)
            //{
            //    Console.WriteLine($"Removed cargo {cargo.Description}");
            //}

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

            //    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();

            //while (true)
            //{
            //    var cargo = new Cargo("Crate with strange eggs", 4);

            //    if (!nostromo.AddCargo(cargo))
            //        break;
            //}



            //Console.WriteLine($"{nostromo.Name}, space available: {nostromo.Available}");
            //Console.WriteLine("- Moving some cargo to Planet Express...");

            //nostromo.MoveCargoToOtherShip(express);

            //Console.WriteLine($"{nostromo.Name}, space available: {nostromo.Available}");
            //Console.WriteLine($"{express.Name}, space available: {express.Available}");

            //express.ListCargo();

            var express  = new TransportShip("Planet Express", 10);
            var nostromo = new TransportShip("Nostromo", 50);
            var station  = new SpaceStation("Solaris");

            express.AddCargo(new Cargo("Item A from Planet Express", 1));
            express.AddCargo(new Cargo("Item B from Planet Express", 1));

            // Planet Express dropping off its cargo to the station
            station.DropOff("secret password key", express);

            // Nostromo picking it up, using the same key
            station.PickUp("secret password key", nostromo);

            Console.WriteLine("-- Planet Express --");
            express.ListCargo();

            Console.WriteLine("--Nostromo--");
            nostromo.ListCargo();
        }