Hello! First time here! Hi my name is Marcos and I’m coding because I believe to become successful you need to either have real estate or create something. I wanted to create an app and here is where I decided to learn and I’m enjoying it very much so far…
Anywho I finished lesson 7 and im trying the exercise however I can only get the console to say the following
“Fuel added
Current Fuel Level at 100”
my code looks as follows…
,
class Spaceship {
var fuelLevel = 50
func liftOff() {
fuelLevel -= 50
print("We have lift off!")
print("Current Fuel Level at: \(fuelLevel)")
}
func addFuel(fuel:Int) {
fuelLevel += fuel
print("Fuel Added")
print("Current Fuel Level at: \(fuelLevel)")
}
func Thrust() {
fuelLevel -= 15
print("Rocket is Thrusting")
print("Current Fuel Level at: \(fuelLevel)")
}
func Cruise() {
fuelLevel -= 5
print("Rocket is Cruising")
print("Current Fuel Level at: \(fuelLevel)")
}
}
let spaceshipObject = Spaceship()
spaceshipObject.addFuel(fuel: 50)
spaceshipObject.liftOff
spaceshipObject.Thrust
spaceshipObject.Cruise
,