Swift - Write program to Create a Vehicle class

Requirements

Write program to Create a Vehicle class

Create a Vehicle class that contains the following properties:

  • model
  • doors
  • color - either red, blue, or white
  • wheels
enum Color: String {
       case Red = "Red"
       case Blue = "Blue"
       case White = "white"
}

class Vehicle {
       var model: String
       var doors: Int
       var color: Color
       var wheels: Int

       init() {
         model = ""
         doors = 0
         color = Color.White
         wheels = 0
     }
}

Related Exercise