Question: This is done in swift for Apple need some help with this Wondering why I have those errors cant get them to go away and
Xcode File EditView Find Navigate Editor Product Debug Source Control Window Help Ready I Today at 1:51 PM 0 2 Lab2-4, Classes VoelkerFrank.Exercise- Define a Base Class The exercises below are based on a game where a spaceship avoids obstacles in space. The ship is positioned at the bottom of a coordinate system and can only move left and right while obstacles "fal" from top to bottom. Throughout the exercises, you'll create classes to represent different types of spaceships that can be used in the game. Create a Spaceship class with three variable properties: name, health, and position. The default value of name should be an empry string and health should be Q. position will be represented by an Int where negative numbers place the ship further to the left and positive numbers place the ship further to the right. The default value of position should be o. 8 class Spaceship O Class 'Spaceship' has no initializers xzt nate: String var health: Double- var position: Int-e e a let constant called falcon and assign it to an instance of Spaceship. After initialization, set name to "Falcon 17 let folcon-Spaceship(name: "Falcon) 0 Spaceship cannot be constructed because it has no accessible initializers Go back and add a method called moveleft() to the definition of Spaceship. This method should adjust the position of the spaceship to the left by one. Add a similar method called noveRight () that moves the spaceship to the right. Once these methods exist, use them to move falcon to the left twice and to the right once. Print the new position of falcon after each change in position. r Lab2-4, classes voelkerfrank.pleyground : 11:141 errori "Spaceship cannot be constructed because it has no accessible inita Let falcenSpaceshiptane: "Falcon-) 23 MacBook Air
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
