Description
CSE 241/505
Object Oriented Programming
Homework # 7
DayofYearSet is a Java class to represent a set of DayOfYear objects (in Turkish DayOfYear kümesi). This class has the following methods and features as well as any other methods that you think are necessary (setters, getters, etc.)
• DayofYear is a static inner class with all its public and private members.
• DayofYearSet class keeps its elements using a DayofYear[] data member.
• Has at least one constructor that takes a ArrayList of DayOfYear objects.
• Overridden ToString method to print DayofYearSet details.
• Overridden equals method comparing DayofYearSet objects. Two sets are equal if their elements are equal regardless of the keeping order.
• Method add adds an element to the set. Please note that no duplicates are allowed in a set.
• Method remove removes an element from the set.
• Method size returns the number of elements.
• Methods for set union, set difference, set intersection, and set complement. Note that there are only 365 days in a year for the complement calculation. • Uses keyword var in its implementation.
• The class will have a static method that returns the total number of DayOfYear objects alive in all the sets. Be careful here because there could be more than one set alive at the same time.
Your class uses a package and nicely provides javadoc comments.
Your driver code will be in a separate class. It will do the following
• Test each method at least 2 times and printing the results. Do not forget to test the constructors.
• Test the De Morgan rule for sets with at least 5 different set pairs. Note that for sets s1 and s2, De Morgan says that !(s1 + s2) == !s1 ^ !s2
• Writes some sets to text files. Do not forget to include your saved files.
Notes:
• Do not use any Java Collection classes as your class fields.
• Do not use anything that we did not learn in the lectures unless asked.
• Check the validity of the user input.
• You should submit your work to the Teams page.
• You should also submit your PDF documentation produced by Javadoc utility.
Reviews
There are no reviews yet.