Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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 .

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases

Authors: Ian Robinson, Jim Webber, Emil Eifrem

1st Edition

1449356265, 978-1449356262

More Books

Students also viewed these Databases questions