Get your Java environment configured with the check-expect testing library
Confirm or refresh your Java design skills.
Some aspects of the 1101/1102 style of writing Java differ from how you probably learned to write Java before (e.g., creating new objects instead of mutating existing ones). We know that. We start this way because there are a lot of design subtleties to using mutation safely. We will cover these in detail after your classmates who are new to Java get up to speed.
If you already have Java experience, we recommend you use Eclipse (unless it annoys you and you prefer a simpler environment). You can find either Eclipse or DrJava by typing in the name in the search box under the programs menu on the lab machines.
If you are using your own laptop, download and install whichever tool you wish to use. See the separate instructions on configuring your environment to use the testing library.
Assume you are creating a class hierarchy for a media manager like iTunes. Your software needs to manage three kinds of items, each of which has a title and a duration: songs, podcast episodes, and audio books. Despite these similarities, these items also have some differences:
Songs and Podcast episodes are part of a larger collection. Songs are part of albums, which have an artist and a number of tracks. Podcast episodes are part of podcasts, which have an author and a frequency at which to check for new episodes (daily, weekly, or unchecked).
Albums and Audio Books are published works. Each has a publisher and a year of release.
Songs and Podcasts are categorizable items; each belongs to a genre, such as news, entertainment, or business for podcasts and rock or country for songs. Users may enter exactly one genre classification per item.
Design a class hierarchy for MediaItem that has all of the features and data described here. You may put all the definitions in a single file or one definition per file, as you prefer. Your design should satisfy the following criteria (include a comment at the end identifying the aspect of your design that satisfies each one):
Concepts of collection, published and categorizable are explicit in the code for your class hierarchy.
Frequency checks are only supported on the pre-defined intervals.
If one added a new kind of media with some combination of the collection, published and categorizable, Java would help check that all relevant methods and data were included for the new media type.
Once you have your definitions, make some examples of data in an Examples class and make sure that you are able to load that class (to check that you have the tester infraastructure configured correctly). Add a simple test case that checks the value of one of your examples to confirm that you have tests working.
Submit all .java files that you produced for this assignment to the Lab1 area via Turnin. If you don’t have a Turnin account or don’t find CS2102 under your available courses, ask your lab staff to create one for you.