CSE 109 Program #0 Due 10:45 PM Thursday 2 February 2012 Late collections: 10:45 PM 4 February 2012, 5 February 2012 In this assignment I ask you to develop a class whose objects are meant to implement the Abstract Data Type (ADT) for a "frequency distribution," which counts the occurences of items in a fixed number of categories. For example, the grades A, B, C, D, and F denote 5 categories, and we could construct a frequency distribution for the number of As, Bs, Cs, Ds, and Fs earned in CSE 109 last semester. In /proj/csc109/p0 I have stored the file p0.cc, which is a driver for testing your class Frequency that implements the ADT for a frequency distribution. The file p0.cc has, at the bottom, the output that was produced when it was run using my implementation of Frequency. Further, I have stored the file 'Makefile' in /proj/csc109/p0. You should copy the files /proj/csc109/p0/p0.cc and /proj/csc109/p0/Makefile into your directory cse109.121/p0 (a directory you should create). You should do all your work in the directory cse109.121/p0. A little green man, or his wife, will collect your work from there. You should add to p0.cc your declaration of class Frequency (before main()), as well as the definitions (code) (after main()), BUT DO NOT CHANGE THE *CODE* THAT I WROTE IN p0.cc AT ALL (BUT IT IS VERY IMPORTANT THAT YOU DO ADD DOCUMENTATION). DO NOT CHANGE THE CODE THAT I WROTE IN ANY WAY, but ADD DOCUMENTATION (name, assignment, program purpose, etc.,) AND YOUR OWN CODE AND DOCUMENTATON FOR THE CLASS Frequency. I will test your class Frequency by compiling and running your p0.cc. (The command 'make' will use the Makefile to do the compilation) When you are ready to submit your work, create the file "DONE" by executing the command "touch DONE". Notes: 1. Both your file p0.cc and your makefile, should have good documentation. Both files should have identifying information at the top, e.g., your name, the course, the assignment number. Your class should be documented with comments at the top which explain the class and its purpose. The role of each data member should be explained. Each function and operator should be explained (e.g., by stating pre- and post-conditions and by stating the overall algorithm). Hard to to understand sections of the code (definitions) should be explained. Normally, the bulk of the documentation belongs with the declarations. The only documentation in the code should be that needed to explain hard to follow code. Note: The documentation for the class and its data and methods should be with the declaration above main(), not the definitions below main(). 2. You should be able to determine the functionality of the class Frequency by looking at the code in main() and the output that I got when I did this programming assignment, but do note that operator[] gives access to the j category but does not allow it to be changed add() increases the frequency in a given category sub() decreases the frequency in a given category total() gives the sum of all the frequencies percent() gives the (int) percentage (e.g., 23) of the total in a given category getSize() returns the number of categories operator+ returns a new distribution by adding the corresponding frequencies in the two distributions, except that it crashes the progrm if you try to sum distributions whose number of categories differ 3. Lehigh claims that you should work, on average, three hours outside of class for every hour spent in class. In this course, you are likely to meet or exceed that average. This STRONGLY SUGGESTS it is not wise to wait until the last minute to do the assignment. If you work ahead and get stuck, you can email me and get help. At the last minute, I probably will not read your email, having gone to bed. 4. A careful examination of my output (at the bottom of p0.cpp) should lead you to conclude that the default size (and maximum size) of any instance of Frequency is 20 categories. IN THE SYLLABUS READ THE STATEMENT ABOUT UNFAIR COLLABORATION AND AVOID UNFAIR COLLABORATION