Course web page: Introduction to Computer Science for non-majors II James Tam Return to the course web page

 

 

CPSC 219: Full Assignment 2

Due Friday Feb 17 at 4 PM

New concepts to be applied for this assignment

Creating a list management program (vacation program)

Write a Java program that allows a person to track a list of  vacation sites.  The full version of the program will allow the user to perform some common list management functions, such as add, displaying, modifying or removing sites.  

Assignment description

The program consists of 4 classes: Destination (place to travel to), Manager (implements the list management features), UserInterface (responsible for text based user input/output), Vacation (the 'driver' of the program).

Destination class: described by three fields:

  1. Name: Consists series of alphabetic and other characters e.g. Dubai
  2. Vacation type: A single alphabetic character
  3. Rating: An integer value between one and five

    Description of the fields

    1. Name

    The name of the site will be stored as a string of characters.

    2. Vacation type

    This field describes the main reason for traveling to this location.  There can be four different categories of sites with each one being represented by a single character code: relaxation (r), excitement (e), culture (c) or food (f).     For the add and modify features your program must be able to check that the user only enters one of these characters for the vacation type and if not it will repeatedly prompt him or her to enter a valid value.  For this assignment you can assume a particular site will not be categorized in multiple ways.  Note: When the user is prompted to enter in the information for a new site he or she will be prompted to only enter in a single character.  However when the information for a site is displayed it show a full description for the vacation type.  (For example, instead of displaying 'r' the program should display something more descriptive like 'relaxation'). Ideally the prompting methods should be part of the UserInterface class. Due to the increased complexity of this approach however you can implement the required methods as part of this class.

    3. Rating

    This field is a numerical value from 1 - 5 that indicates how much that the person wants to go to a particular vacation spot with 5 being the most desirable and 1 being the least desirable.  As was the case with the previous attribute, your program must be able to check that the user enters a value within this range and will repeatedly re-prompt him or her to enter in a proper value when this doesn't occur until a valid value has been entered. 

Manager class: Manager: Stores the array of vacation destination sites, implements the list management functions (display, add, modify, remove, search).  Your program should be able to track a reasonably large number of vacation sites (e.g., 100).

A basic version of the program will only add and remove elements from the end. A superior version (higher grade) can perform an in-order add (alphabetically ordered by destination name case insensitive e.g. 'cambodia' always comes before 'Canada') although the program doesn't have to check for duplicates (e.g. 'London' Ontario vs. 'London' England and the program could allow for two entries of 'London's).

As well the superior program can allow the user to specify the destination name and remove the first instance where the destination name entered by the user matches the destination name of an element in the list.

With the 'modify' feature, the program searches and modifies the first instance of a particular destination name while search displays all instances of given name.

Finally with the 'display' feature only occupied array elements will be displayed. For instance if the array can contain 100 destinations but the user has only entered 3destinations then only three array elements will be shown onscreen. To help you visualize how the superior list management features will work here is a set of notes describing how a list management features such as add and remove be implemented. [Extra notes on lists]/ The source code can be found through this [web link] or in UNIX under: /home/219/assignments/assignment2/code

UserInterface class (UI): similar to the class with the same name covered by the TAs in tutorial which can be found at [this link] or in UNIX under /home/219/tutorials/jan29_feb4/userInterface. For this program the UI class will implement the code for displaying, getting input for this menu, validating the input and then sending an appropriate message to the Manager class. Consequently the UI needs a Manager as an attribute. (E.g. when the user selects option 'a' from the menu then the UI will notify the Manager class that it should run it's 'add' method or methods).Valid menu options for the main menu include:

The program should detect an invalid selection and display an appropriate error message. However input should be case sensitive e.g. 'a' or 'A' invokes the first option.

Vacation class: The starting execution point for your program.  You should probably instantiate an instance of class ManagerUserInterface in the 'main()' method.

Marking

As well as being marked on whether "your program works" you will also be marked on non-functional requirements such as style and documentation. Consequently this assignment will include a separate [marking checklist]

Points to keep in mind:

  1. Due time: All assignments are due at 4 PM on the due dates listed on the course web page.  Late assignments or components of assignments will not be accepted for marking without approval for an extension beforehand. The latest versions of the files that you have submitted in D2L as of the due date is what will be marked.
  2. Extensions may be granted for reasonable cases by the course instructor with the receipt of the appropriate documentation (e.g., a doctor's note). Typical examples of reasonable cases for an extension include: illness or a death in the family. Cases where extensions will not be granted include situations that are typical of student life: having multiple due dates, work commitments etc. Tutorial instructors (TA's) will not be able to provide extension on their own and must receive permission from the course instructor first. (Note: Forgetting to hand your assignment or a component of your assignment in does not constitute a sufficient reason for handing your assignment late).
  3. Method of submission: You are to submit your assignment using D2L [help link]. Make sure that you [check the contents of your submitted files] (e.g., is the file okay or was it corrupted, is it the correct version etc.). It's your responsibility to do this! (Make sure that you submit your assignment with enough time before it comes due for you to do a check).
  4. Identifying information: All assignments should include contact information (full name and student ID number) at the very top of your program in the class where the 'main()' method resides. (Note other documentation is also required for most assignments).
  5. Collaboration: Assignments must reflect individual work; group work is not allowed in this class nor can you copy the work of others.  For more detailed information as to what constitutes academic misconduct (i.e., cheating) for this course please read the following [link].
  6. Execution: programs must run on the computer science network running Java 8.x. If you write you code in the lab and work remotely using a remote login program such as Putty or SSH then should already be using the correct version. If you choose to install Java on your own computer, then it is your responsibility to ensure that your program will run properly on the CPSC Linux computers. It's not recommended that you use an IDE for writing your programs but if you use one then make sure that you submit your program in the form of text ".java" file or files. If you only submit your byte code files (e.g. Driver.class) then you will not be awarded any credit.
  7. Use of pre-created Java libraries: unless otherwise told you are to write the code yourself and not use any pre-created functions from the Java libraries. For this assignment the usual acceptable functions include: System.out.print(), System.out.println(), the methods of the Console class and for some assignments the methods of the Random class. Look at the particular assignment description for a list of other classes that you are allowed to use and still get credit in an assignment submission.
  8. Style conventions, programming decomposition: the marking points from the previous assignment also apply to this assignment. The one blanket exception is the use of a static debugging flag (or flags) if you choose to implement multiple flags.

D2L configuration:

Marking: