So I have two Strings: type and color. For some reason I can't use "getType" or "getColor". The error comes at the bottom in the second method (public boolean equals(String aClothing)). How can I fix this?
public class Clothing {
// Attributes
private String type;
private String color;
// Constructors
public Clothing() {
this.type = "no type yet";
this.color = "no color yet";
}
public Clothing(String aType, String aColor) {
this.setType(aType);
this.setColor(aColor);
}
// Accessors (getters)
public String getType() {
return this.type;
}
public String getColor() {
return this.color;
}
// Mutators (setters)
public void setType(String aType) {
this.type = aType; // TODO check invalid values
}
public void setColor(String aColor) {
this.color = aColor; // TODO check invalid values
}
// Methods
public String toString() {
return this.type + " " + this.color;
}
public boolean equals(String aClothing) {
return aClothing != null && this.type.equals(aClothing.getType()) && this.color.equals(aClothing.getColor());
}
}