Skip to content

Commit a88b77b

Browse files
author
“Karensprojects22”
committed
feat: adds PersonalCloset and PersonalClosetTest file
1 parent dbd5296 commit a88b77b

File tree

1 file changed

+92
-0
lines changed
  • lesson_16/objects/objects_app/src/main/java/com/codedifferently/lesson16/wardrobecollection

1 file changed

+92
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
package com.codedifferently.lesson16.wardobecollection;
2+
3+
import java.util.List;
4+
import java.util.Map;
5+
import java.util.ArrayList;
6+
import java.util.HashMap;
7+
8+
// Personal closet class to represent persons wardrobe collection
9+
public class PersonalCloset {
10+
// Enum for seaons
11+
public enum Season {
12+
FALL,
13+
WINTER,
14+
SPRING,
15+
SUMMER,
16+
ALL_SEASON
17+
}
18+
19+
// Member variables
20+
private String ownerName;
21+
private int maxCapacity;
22+
private double totalValue;
23+
private boolean isOrganized;
24+
private ArrayList<Clothing Item> items;
25+
private HashMap<Season, Integer> seasonalItems;
26+
27+
// Constructor for personal closet
28+
public PersonalCloset (String ownerName, int maxCapacity) {
29+
this.ownerName = ownerName;
30+
this.maxCapacity = maxCapacity;
31+
this.totalValue = 0.0;
32+
this.isOrganized = false;
33+
this.items = new ArrayList<>();
34+
this.seaonalItems = new HashMap<>();
35+
}
36+
37+
//core methods
38+
39+
// adds item to closet
40+
public boolean addItem(ClothingItem item) {
41+
return false;
42+
}
43+
44+
// removes item from closet
45+
public void removeItem(ClothingItem item) {
46+
// throws exception if item is not found in closet
47+
public static class ItemNotFoundException extends Exception{
48+
49+
}
50+
}
51+
52+
// creates outfit by selecting items based on the season
53+
public List<Clothing Item> createOutfit(Season season) {
54+
return new ArrayList<>();
55+
}
56+
57+
// organizes closet by type of item and color
58+
public void organizeCloset() {
59+
}
60+
61+
// calculates amount of clothing items are in closet based on season
62+
public Map<Season, Double> getSeasonalItem() {
63+
return new HashMap<>();
64+
}
65+
66+
// getters and setters
67+
public String getOwnerName() {
68+
return ownerName;
69+
}
70+
71+
public void setOwnerName() {
72+
this.ownerName = ownerName;
73+
}
74+
75+
public int getMaxCapacity() {
76+
return maxCapacity;
77+
}
78+
79+
public double getTotalValue() {
80+
return totalValue;
81+
}
82+
83+
public boolean isOrganized () {
84+
return isOrganized;
85+
}
86+
87+
public List<ClothingItem> getItems() {
88+
return new ArrayList<>(items);
89+
}
90+
91+
}
92+

0 commit comments

Comments
 (0)