Advertisement
ProGramm

Assignment 4: 1 - Creating objects in Traffic

Oct 12th, 2014
3,376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Eiffel 0.89 KB | None | 0 0
  1. note
  2.     description: "Creating new objects for Zurich."
  3.  
  4. class
  5.     OBJECT_CREATION
  6.  
  7. inherit
  8.     ZURICH_OBJECTS
  9.  
  10. feature -- Explore Zurich
  11.  
  12.  
  13.     explore
  14.     local               --- Define a local variables
  15.         p1: VECTOR
  16.         p2: VECTOR
  17.         building: BUILDING
  18.         leg1: LEG
  19.         leg2: LEG
  20.         leg12: LEG
  21.         route1: ROUTE
  22.  
  23.             -- Create new objects for Zurich.
  24.         do
  25.             -- Ein Gebäude auf der Karte anzeigen (grau hinterlegt).
  26.             create p1.make (200, -100)
  27.             create p2.make (250, 0)
  28.             create building.make ("HG", p1, p2)
  29.             Zurich.add_building (building)
  30.  
  31.  
  32.  
  33.             -- Eine Route von ETH über Paradeplatz zur Oper.
  34.             --create leg1.make (Zurich.station ("Polyterasse"), Zurich.station ("Central"), Zurich.line (24))
  35.             create leg2.make (Zurich.station ("Central"), Zurich.station ("Opernhaus"), Zurich.line (4))
  36.             --leg2.link (leg1)
  37.             create route1.make (leg2)
  38.             Zurich.add_route (route1)
  39.  
  40.  
  41.  
  42.         end
  43.  
  44.  
  45.  
  46.  
  47. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement