Advertisement
Hadlock

airport classes

Jul 3rd, 2015
338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #define class
  2. $Jet = new-object psobject -Property @{
  3.     guid = $null
  4.     airline = $null
  5.     flight  = $null
  6.     passengers = $null
  7.     crew = $null
  8.     fuel = $null
  9.     cargo = $null
  10.     model = $null
  11. }
  12.  
  13. #constructor
  14. function Jet { #constructor
  15.     param(
  16.           [Parameter(Mandatory=$false)]
  17.           [guid]$guid,
  18.           [Parameter(Mandatory=$false)]
  19.           [string]$airline,
  20.           [Parameter(Mandatory=$false)]
  21.           [int]$flight,
  22.           [Parameter(Mandatory=$false)]
  23.           [int]$passengers,
  24.           [Parameter(Mandatory=$false)]
  25.           [int]$crew,
  26.           [Parameter(Mandatory=$false)]
  27.           [int]$fuel,
  28.           [Parameter(Mandatory=$false)]
  29.           [int]$cargo,
  30.           [Parameter(Mandatory=$false)]
  31.           [string]$model
  32.     )
  33.     $Jet = $Jet.psobject.copy()
  34.     $Jet.guid = [guid]::NewGuid() #$guid #[System.GUID]::NewGuid().ToString().ToUpper()
  35.     $Jet.airline = $airline
  36.     $Jet.flight = $flight
  37.     $Jet.passengers = $passengers
  38.     $Jet.crew = $crew
  39.     $Jet.fuel = $fuel
  40.     $Jet.cargo = $cargo
  41.     $Jet.model = $model
  42.     $Jet
  43. }
  44.  
  45. #define class
  46. $Airspace = new-object psobject -Property @{
  47.     active = $null
  48.     jets = $null
  49.     type = $null
  50. }
  51.  
  52. #constructor
  53. function Airspace { #constructor
  54.     param(
  55.           [Parameter(Mandatory=$false)]
  56.           [bool]$active,
  57.           [Parameter(Mandatory=$false)]
  58.           [int]$jets,
  59.           [Parameter(Mandatory=$false)]
  60.           [string]$type
  61.     )
  62.     $Airspace = $Airspace.psobject.copy()
  63.     $Airspace.active = $active
  64.     $Airspace.jets = $jets
  65.     $Airspace.type = $type
  66.     $Airspace
  67. }
  68.  
  69.  
  70.  
  71. #start using classes
  72. $Airspace = Airspace -active 1 -jets 0 -type Civilian
  73. $Jet1 = Jet -airline American -flight 551 -passengers 200 -crew 20 -fuel 1000 -cargo 1 -model 777
  74. $Jet2 = Jet -airline Southwest -flight 1001 -passengers 100 -crew 10 -fuel 500 -cargo 1 -model 737
  75. $Jet3= Jet -airline United -flight 552 -passengers 300 -crew 20 -fuel 1000 -cargo 1 -model 747
  76.  
  77. #$Airspace
  78. $Jet1
  79. $Jet2
  80. $Jet3
  81. $Airspace
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement