Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Class Vehicle
- Private Colour As String
- Private Windows As String
- Private Doors As Integer
- Private Engine As String
- Public Sub SetColour(ByVal c As String)
- Colour = c
- End Sub
- Public Sub SetWindows(ByVal w As String)
- Windows = w
- End Sub
- Public Sub SetDoors(ByVal d As Integer)
- Doors = d
- End Sub
- Public Sub SetEngine(ByVal e As String)
- Engine = e
- End Sub
- Public Function GetColour() As String
- Return (Colour)
- End Function
- Public Function GetWindows() As String
- Return (Windows)
- End Function
- Public Function GetDoors() As Integer
- Return (Doors)
- End Function
- Public Function GetEngine() As String
- Return (Engine)
- End Function
- End Class
- Class Car
- Inherits Vehicle
- Private Trunk As String
- Private Model As String
- Public Sub SetTrunk(ByVal t As String)
- Trunk = t
- End Sub
- Public Sub SetModel(ByVal m As String)
- Model = m
- End Sub
- Public Function GetTrunk() As String
- Return (Trunk)
- End Function
- Public Function GetModel() As String
- Return (Model)
- End Function
- End Class
- Class Truck
- Inherits Vehicle
- Private Off_Road As String
- Private Bed_Type As String
- Public Sub SetOff_Road(ByVal r As String)
- Off_Road = r
- End Sub
- Public Sub SetBed_Type(ByVal b As String)
- Bed_Type = b
- End Sub
- Public Function GetOff_Road()
- Return (Off_Road)
- End Function
- Public Function GetBed_Type()
- Return (Bed_Type)
- End Function
- End Class
- Module Module1
- Sub Main()
- Dim TestCar As New Car
- Dim TestTruck As New Truck
- TestCar.SetColour("Blue")
- TestCar.SetWindows("Power Windows")
- TestCar.SetDoors(4)
- TestCar.SetEngine("V6")
- TestCar.SetTrunk("Trunk")
- TestCar.SetModel("Sedan")
- TestTruck.SetColour("Black")
- TestTruck.SetWindows("Power Windows")
- TestTruck.SetDoors(4)
- TestTruck.SetEngine("V8")
- TestTruck.SetOff_Road("Off Road")
- TestTruck.SetBed_Type("Extended")
- Console.WriteLine("The car colour is " & TestCar.GetColour & ".")
- Console.WriteLine("The car windows are " & TestCar.GetWindows & ".")
- Console.WriteLine("The car has " & TestCar.GetDoors & " doors.")
- Console.WriteLine("The car engine is " & TestCar.GetEngine & ".")
- Console.WriteLine("The car trunk is a " & TestCar.GetTrunk & ".")
- Console.WriteLine("The car model is a " & TestCar.GetModel & ".")
- Console.WriteLine()
- Console.WriteLine("The truck colour is " & TestTruck.GetColour & ".")
- Console.WriteLine("The truck windows are " & TestTruck.GetWindows & ".")
- Console.WriteLine("The truck has " & TestTruck.GetDoors & " doors.")
- Console.WriteLine("The truck engine is " & TestTruck.GetEngine & ".")
- Console.WriteLine("The truck off-road capability is a " & TestTruck.GetOff_Road & ".")
- Console.WriteLine("The truck bed type is " & TestTruck.GetBed_Type & ".")
- End Sub
- End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement