Extra Credit: Learning Enumerated Types
Objectives:
- To learn a useful Java structure on your own
- To figure out what information you need (and don't need) to solve a problem.
- To learn about enumerated types
Due: November 18 before class
Learning Enumerated Types
Java provides a tutorial about enumerated types in Java. Feel free to consult other references. Let me know if you find any that are especially useful.
Creating Your Own Enumerated Type
(Up to 20 points) MPAA Ratings
Create a new enum type that represents
the MPAA
rating for DVD
objects from
your MediaItem
-based projects. Also include if the
movie is not rated. Your new enum type should have a method that,
given a person's age, determines if the person should be allowed
into a movie and a method that returns the rating as a String in a
user-friendly way.
Modify your DVD
class to use the new type instead of however
you represented ratings before. Create a driver or some kind of test that
shows the correctness of your new enum type.
Create a text file called CRITIQUE
where you discuss
enumerated types. How difficult were these to learn? How easy/difficult it
would be to implement this functionality without enumerated types?
Submission
Create a jar file of your project.
Copy your jar file into a ec_enumtypes
directory in your turnin
directory. Email
me to let me know that you submitted the assignment.
Grading (Up to 20 pts extra credit on lab grade)
You will be evaluated based on the following criteria:
- Correctness of each program
- Style, organization, evidence of testing