Class Documentation: This class, ChoreChart, is a class that I have used to combat a problem that my roommates and I face. Our apartment has become very messy and we needed a way to generate a chore chart, so that basic chores, such as cleaning the kitchen and cleaning the bathrooms. This class helps us generate a chore chart that can randomly select a chore for each person that lives in this house. This class is capable of creating a chore chart schedule for multiple weeks. It is also capable of keeping track of the amount of times people have had free weeks. The chore chart that's generated for however many weeks inputted, completely random each time, therefore making it a fair way for my roommates and I to decide who does what chore for the week.
The class variable, chores_list, is the list of chores that need to get done. Self.__weeks is the number of weeks that the user wants to generate chore lists for. Self.__names is the list of the names of people that live in our apartment. Self.__freeweeklist is originally an empty list and then it becomes a a list of all the people that have had a free week and what week they had a free week. Self.__choresweekslist is originally an empty list and then it becomes a list of all the chore lists for every week. Self.__freeweekcounter is originally an empty dictionary and then it becomes a dictionary with names as the keys and the number of weeks they've had free as the values. Self.__choresassigned is originally an empty dictionary and then becomes a dictionary with names as the keys and their corresponding chores as the values. These corresponding chores are generated from the data variable self.__chore, which is equal to a random chore picked from the class variable, chores_list. Self.__free is a string that states the name of who has a free week. For every week that a chores list is generated, self.__free will get added to the list self.__freeweeklist. Self.__finalfreeweekcounter is originally an empty list and then it becomes a list with each item being a string containing a name and the number of weeks that they have free.
The init method initializes the self.__names and self.__weeks data variables. The init takes in the arguments, names, which is a list of names, and weeks, which is the number of weeks the user wants chore lists generated for. The set_freeweeklist method is the first set method that sets self.__freeweeklist to an empty list. The set_choresweeklist method is the second set method that sets self.__choresweekslist to an empty list. The choreweeklistgenerator method generates the final list for self.__choresweekslist, the final list for self.__freeweeklist, and the final dictionary for self.__freeweekcounter. The finalfreeweekcounter method returns a string, with each line being a sentence that states a name and how many weeks they have free. The get_choresweekslist method is the first get method that returns a string with each line in the string stating the week number and the corresponding chore list for that week. The get_freeweeklist method is the second get method that returns a string with each line in the string stating the week number and the corresponding name of the person who has a free week for that week.
Demo Documentation: To run the demo program, all you need to do is press the run button. The demo program first sets the variable chore to the class ChoreChart, with the input of the list of my roommates names and the number of weeks that I want chore lists for. It then runs the set_freeweeklist, set_choresweekslist, and choresweeklistgenerator methods. It will then print, line by line, a chore list for each week for the number of weeks that I inputted. It will then print, line by line, who has a free week and for which week that they are free. Lastly, it will print, line by line, who has how many weeks off in the total number of weeks that the code generated chore lists for.