Question: First photo is the parent class. Second one is a subclass of the code. Fill in blanks. Some words can be used more than once

 First photo is the parent class. Second one is a subclass

First photo is the parent class. Second one is a subclass of the code. Fill in blanks. Some words can be used more than once .

of the code. Fill in blanks. Some words can be used more

1 6 7 86 2 public class GameItem { 3 protected String name; 4 50 public String getName() { return name; } public void setName(String name) { 9 this.name = name; 10 } 110 protected GameItem(String name) { 12 this.name=name; } 140 public void use() { 15 16 } 176 public void displayAttributes(){ 18 System.out.println("Item name: "+name); 19 } 20 21 } 22 13 4 12 1 import java.util.ArrayList; 2 3 public class Container GameItem Openable{ ArrayList content= new ArrayList(); 5 4 boolean isOpen=false; 6 70 Container (String name) { 8 6 (name); 9 // TODO Auto-generated constructor stub 10 } 110 public void displayAttributes() { 7.displayAttributes(); 13 for(GameItem : 8 ) { System.out.println(c); } } 170 public void use() { System.out.println("You use the "+this.name); 19 } 200 public void open() { 21 System.out.println("You open the"+this.name); 22 . isOpen=true; 23 } 240 public void close() { System.out.println("You close the "+this.name); 26 10 .isOpen=false; 27 } 28 29 } 14 15 16 18 25

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!