Android Build an Interactive Story App Finishing the User Interface Using a Model in the Presenter

There is a compiler error. Please click on preview to view your syntax errors! Restart

i don't whats wrong with my code
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class LandingActivity extends Activity {

    public Button mThrustButton;
    public TextView mTypeLabel;
    public EditText mPassengersField;

    public Spaceship mSpaceship;

    public void onCreate(Bundle savedInstanceState) {

        mThrustButton = (Button)findViewById(;
        mTypeLabel = (TextView)findViewById(;
        mPassengersField = (EditText)findViewById(;

        // Add your code here!
        mSpaceship = new Spaceship("FIREFLY");
        mPassengersField.setText(mSpaceship.getNumPassengers() + "");
public class Spaceship {
    private String shipType;
    private int numPassengers = 0;

    public String getShipType() {
      return shipType;

    public void setShipType(String shipType) {
      this.shipType = shipType;

    public int getNumPassengers() {
      return numPassengers;

    public void setNumPassengers(int numPassengers) {
      this.numPassengers = numPassengers;

    public Spaceship() {
      shipType = "SHUTTLE";

    public Spaceship(String shipType) {
      this.shipType = shipType;
   public Spaceship(String type) { //<----You have to type a String inside the method
      mType = type;

1 Answer

Seth Kroger
Seth Kroger
56,382 Points

There are a couple of things causing the errors. First, the getter in the task is named getShipType(), not getType(). Second, I see you changed all the variables over to the m-prefix notation. That's perfectly fine for your own work, but the challenge tester will expect them to retain their original names.