Write the printItem() method for the base class. Sample output for below program:

Last name: Smith
First and last name: Bill Jones
// ===== Code from file BaseItem.java =====
public class BaseItem {
protected String lastName;

public void setLastName(String providedName) {
lastName = providedName;
return;
}

// FIXME: Define printItem() method

/* Your solution goes here */

}
// ===== end =====

// ===== Code from file DerivedItem.java =====
public class DerivedItem extends BaseItem {
private String firstName;

public void setFirstName(String providedName) {
firstName = providedName;
return;
}

Respuesta :

Answer:

The printItem() method code is filled in the explanation, highlighted with bold font.

Explanation:

// ===== Code from file BaseItem.java =====

public class BaseItem {

  protected String lastName;

  public void setLastName(String providedName) {

      lastName = providedName;

      return;

  }

// FIXME: Define printItem() method

/* Your solution goes here */

  public void printItem() {

      // TODO Auto-generated method stub

      System.out.println("Last name: "+lastName);

  }

}

// ===== end =====

In this exercise we have to use the knowledge of computational language in JAVA to write the code:

We have that can be found in the attached image.

To make it simpler we find the code below as:

public class BaseItem {

 protected String lastName;

 public void setLastName(String providedName) {

     lastName = providedName;

     return;

 }

// FIXME: Define printItem() method

/* Your solution goes here */

 public void printItem() {

     // TODO Auto-generated method stub

     System.out.println("Last name: "+lastName);

 }

}

See more about JAVA at brainly.com/question/2266606

Ver imagen lhmarianateixeira
ACCESS MORE
EDU ACCESS