Part A: (ungraded) Read Chapters 6-9. Look at the review questions for each chapter. Recommended exercises: chapter 6 exercises 4 and 12, chapter 7 exercise 12, chapter 9 exercise 6. Write and run a JAVA program to check your answers. You are permitted to work together on any ungraded work for the course. You do not have to submit anything.
Part A: Exercise Class [45 pts]
The purpose of this assignment is to write a class called Exercise that can be used to create and manipulate exercise events that you want to keep track of, perhaps in an exercise log or diary of some sort. (We will use this class in a later assignment to do just that.) The data members (fields) of each exercise object must be private and include what type of exercise it is ("Biking", "Dancing", etc.) and some information regarding the timing of the exercise event. You will need to use the Time.java class from lectures in order to support this class definition, so make sure you have downloaded it into the same file folder where you are storing this program code. Once you do that, you can use our Time class much as you use the String class from the Java API - create objects and call it's methods as necessary.
Your class must also have a private class (static) data member which lists all the different activity types that have been created so far. For now, do this with one String or StringBuffer. Each time an Exercise object is created, check to see if its type already appears in this list, and if not add it to the end. Separate exercise types with a space for readability. [6 pts data members]
Your Exercise class must have the following public instance methods. The exact details of how these methods work can be derived from examining the test driver program pg5a.java that we have written for you. You must write your methods so that they match exactly the methods used in that driver program with respect to names, parameter types, and return types. Note that the methods are expected to do their jobs based on the values of the data members in your class. There is no user input for any part of this assignment. The grading value of each method is noted in [] at the start of each item below.
[2] In addition to those instance data methods, you must have a class method called "getTypes" that can be used to find out what types of exercise events have been created so far. This method should return a string that begins with "Exercise types: ", followed by the actual list.
YOUR CLASS IS REQUIRED TO WORK WITH OUR POSTED TEST PROGRAM!! This means that you must use our program pg5a.java to develop and test your class. Read it carefully to determine exactly what to name each method above, and clarify what their parameters and return types should be. Ultimately you must be able to compile and run pg5a.java using your Exercise.java class and our Time.java class. All three of these files must be stored in the same file folder when developing your code. If there appear to be compiler errors for pg5a.java or Time.java, you must fix your Exercise class to get rid of them, not pg5a or Time. Otherwise you will get a 0 for the assignment.
[10 pts] You must write complete javadoc style comments for all the methods in your Exercise.java class file. Also remember to use descriptive variable names, nice spacing, etc. Don't forget to put a header comment on your class file, and a reflection on the assignment.
You must submit your Exercise.java file on Blackboard. Even though you are not permitted to change pg5a.java or Time.java, please submit them as well in one complete zip file (containing all three java files) to make grading easier for us. You will be strictly required to submit zip files in the future, so its best to learn how to do it now. Because the due date is pushed back to Friday, we will not be collecting printouts for this assignment.
Development Hints: first write the dummy methods for everything required by pg5a.java. A dummy method includes the full header, and a made-up return value if one is expected. Next add the instance and class data members that will be needed. Then write the bodies of your constructor and toString methods. Test. Fill in the other method definitions one at a time, testing each as you go along.
General assignment requirements, style and submission details: