My program has a ZodiacType enum with constants and values for below.
enum ZodiacType {
ARI(ZodiacInfo.Aries, "March 21", "April 19"),
TAU(ZodiacInfo.Taurus, "April 20", "May 20"),
GEM(ZodiacInfo.Gemini, "May 21", "June 20"),
CAN(ZodiacInfo.Cancer, "June 21", "July 22"),
LEO(ZodiacInfo.Leo, "July 23", "August 22"),
VIR(ZodiacInfo.Virgo, "August 23", "September 22"),
LIB(ZodiacInfo.Libra, "September 23", "October 22"),
SCO(ZodiacInfo.Scorpio, "October 23", "November 21"),
SAG(ZodiacInfo.Sagittarius, "November 22", "December 21"),
CAP(ZodiacInfo.Capricorn, "December 22", "January 19"),
AQU(ZodiacInfo.Aquarius, "January 20", "February 18"),
PIS(ZodiacInfo.Pisces, "February 19", "March 20");
private final ZodiacInfo description;
private final String startDate;
private final String toDate;
ZodiacType(ZodiacInfo description, String startDate, String toDate) {
this.description = description;
this.startDate = startDate;
this.toDate = toDate;
}
}
And another Set class which contains one ArrayList as below
class Set {
private ArrayList<ZodiacType> s;
public Set() {
s = new ArrayList<>();
}
public void addElement(ZodiacType element) {
s.add(element);
}
public boolean subSet (Set otherSet) {
if (s.containsAll(otherSet.s)) {
return true;
} else
return false;
}
}
If I was to develop two methods
private static Set getASet() {
private ZodiacType getAnElement() {
for randomly generate and add to that particular ArrayList (5 elements) and display, is there any solution for this two new methods and I really curious any provided solutions since I am really weak to imagine the logic flow. The output that is required:
Here is an example of set A = {AQU, TAU, CAN, GEM, CAP}. All elements in set are distinct and random number.