Question
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started