Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA - Grace wants to implement a system that can keep tabs on her laundry. Create two classes, Clothing and ClothingInventory. Clothing has to have

JAVA - Grace wants to implement a system that can keep tabs on her laundry. Create two classes, Clothing and ClothingInventory.

Clothing has to have these public methods:

  • Clothing(String itemName, String description, boolean clean) // Constructor that constructs the Clothing object

    • itemName: name of clothing item

    • description: description of clothing item

    • clean: whether or not the clothing item is clean

  • String getItemName() // returns item name

  • void setItemName(String ItemName) // sets the item name to the given item name

  • String getDescription() // returns clothing description

  • void setDescription(String description) // sets the clothing description to the given clothing description

  • boolean isClean() // Returns true if the clothing is clean, if not, it would return false

  • void setClean(boolean clean) // sets the clean property to the given value

ClothingInventory has to have these public methods:

  • ClothingInventory() // Constructor that constructs a new ClothingInventory object

  • void addClothing(Clothing item) // adds the given item if a clothing item with that name doesn't already exist in the inventory

  • void removeClothing(String itemName) // removes the clothing item with the given name if it exists in the inventory

  • String getInventoryReport() // returns a String that lists the clothing name, description of clothing item, and the words clean or not clean

Example in main:

Clothing whiteShirt = new Clothing("white shirt", "white t-shirt with pocket", false);

Clothing jeans = new Clothing("jeans", "black jeans", true);

ClothingInventory inventory = new ClothingInventory();

inventory.addClothing(whiteShirt);

inventory.addClothing(jeans);

inventory.removeClothing("jeans");

inventory.getInventoryReport();

OUTPUT

White shirt

white t-shirt with pocket

clean

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

Advanced Database Systems

Authors: Carlo Zaniolo, Stefano Ceri, Christos Faloutsos, Richard T. Snodgrass, V.S. Subrahmanian, Roberto Zicari

1st Edition

155860443X, 978-1558604438

More Books

Students also viewed these Databases questions

Question

1. Traditional and modern methods of preserving food Articles ?

Answered: 1 week ago

Question

What is sociology and its nature ?

Answered: 1 week ago

Question

What is liquidation ?

Answered: 1 week ago

Question

Explain the different types of Mergers.

Answered: 1 week ago