Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Wondering why I have those errors can’t get them to go away and also best way to

ID: 3752761 • Letter: W

Question

Wondering why I have those errors can’t get them to go away and also best way to do the other two parts 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

Explanation / Answer

..It is very basic error new programmer faces. Always add access specifier with class and add default constructor is a good practice.

1.add Public access specifier

2.write a constructor in class

Add more details for rest of the part

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote