Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

\"Objective: Write a program that will sort a basket of clothes into their prope

ID: 3603127 • Letter: #

Question

"Objective: Write a program that will sort a basket of clothes into their proper drawers. If you were not aware you are sort clothes by their type in this order: Top Drawer – Undergarments, Next Drawer – Socks or Stockings, The Following Drawer – Tops, The Subsequent Drawer – Bottoms, The Cape Drawer – Capes"

I am having problems with my "remove" part of this problem. My add method works fine but the remove does not. Any idea what I am doing wrong? My code and the full prompt are below.

public void AddClothes(Clothing myGarment) i int i-0; for(Clothing_Type type: Clothing_Type.valuesO) E if(type--myGarment.getTypeO) ifci>l) int tempSpot = getVacantSpot(i); if(tempSpot !=-1) { this. clothesList[i][tempSpot] = myGarment; else System.out.printlnC"No space available. Try another drawer."); break; i-1 ; //Method to remove clothing public void RemoveClothes(Clothing myGarment) t for(int i-0;i

Explanation / Answer

Suggestion for RemoveClothes is as follows:

Instead of using equals method to compare the clothing objects , use the
explicitly the color and type of the object to compare with the object
in clothing list.