示例#1
0
        public static void Main(String []args)
        {
            City dublin = new City(53.353, -6.267, "Dublin");
            City newYork = new City(40.727, -74.007, "New York");

            Park newpark = new Park(53.362, -6.328, "Phoenix Park");
            dublin.addLocation(newpark);
            //dublin.addToParks(newpark);
            //newYork.addToParks(newpark);

            TrainStation newTrainStation = new TrainStation(53.3513, -6.2498, "Connolly Station / Amiens Street Station");
            dublin.addLocation(newTrainStation);
            //dublin.addToTrainStations(newTrainStation);
            //newYork.addToTrainStations(newTrainStation);

            School newSchool = new School(53.3513, -6.2498, "Loreto College, Crumlin");
            dublin.addLocation(newSchool);

            Hospital newHospital = new Hospital(53.3513, -6.2498, "Crumlin Childrens Hospital");
            dublin.addLocation(newHospital);

            Console.WriteLine("The name of the city is " + newpark.city.getName());

            Console.WriteLine("The name of the Park is " + newpark.getName());
            Console.WriteLine("The name of the train station is " + newTrainStation.getName());
            Console.WriteLine("The name of the school is " + newSchool.getName());
            Console.WriteLine("The name of the hospital is " + newHospital.getName());
            Console.ReadLine();
        }
 public TrainStation(double Lat, double Long, string tsName)
     : base(Lat, Long, tsName)
 {
     this.city = null;
     this.wheelchairFriendly = true;
     this.taxiRank = true;
     this.carPark = true;
 }
 public Hospital(double Lat, double Long, string tsName)
     : base(Lat, Long, tsName)
 {
     this.city = null;
     this.wheelchairAccess = true;
     this.taxiRank = true;
     this.carPark = true;
     this.bankFacilities = true;
     this.flourist = true;
 }
示例#4
0
        static void Main(string[] args)
        {
            //create a person object
            Person josh = new Person("Josh", 26, 130);

            //create our cars inventory
            List<Car> carInventory = new List<Car>();

            //create cities
            List<City> cities = new List<City>();

            City city1 = new City("New York City", 100);
            City city2 = new City("Chicago", 200);

            cities.Add(city1);
            cities.Add(city2);

            //add cars to the inventory
            Car car1 = new Car("volkswagon", "gti", 2015, 25000);
            Car car2 = new Car("mazda", "3", 2014, 20000);
            Car car3 = new Car("subaru", "impreza", 2015, 23000);

            carInventory.Add(car1);
            carInventory.Add(car2);
            carInventory.Add(car3);

            //invoke methods on the person object
            josh.personInfo();
            josh.workOut(50);

            //josh.buyCar("Volkswagon", "GTI", carInventory);
            josh.buyCar("3", "Mazda", carInventory);
            josh.viewCars();
            //josh.driveCar("Mazda", "3", cities, "Chicago");
            josh.driveCar("Mazda", "3", cities, "New York City");

            Console.ReadLine();
        }
示例#5
0
 public Park(double Lat, double Long, string parkName)
     : base(Lat, Long, parkName)
 {
     this.city = null;
     this.facilities = "none";
 }