Back to the faculty page for James Tam Return to the course web page

 

CPSC 233: Full Assignment 2

Due at 4 PM. For assignment due dates see the main grid on the course webpage.

New Concepts to be applied for the assignment

 Note: it is not sufficient to just implement a working program and expect full credit. Even if your program is fully working and the design is not as specified in this document (E.g. your program implements static methods other than the main method or only a single class is used) then your marks will suffer greatly. (Your raw grade point is quartered if you do these two things i.e. an 'A' becomes a 'D' grade). There are other crucial design requirements but I used two extreme examples to make a point. You are to learn and practice good Object-Oriented principles in CPSC 233 and you are expected to be able to apply these principles in higher level courses. If you want an idea of the "how not to do it" approach here is a small example that includes a static method (other than main) and you can presume it contains the entire solution for this assignment (no I am not going to post a complete solution for A1 here) all in the definition for class HowNotToDoItManager. Note: the prohibition on the use of static methods does not necessarily apply to static class constants (e.g. public static final double PI from class Math is an example of good style, the appropriate use of class constants.)

Using predefined Java classes that implement basic array operations.

One of the learning objectives for this assignment is give students hands on experience writing code for common array operations and there are three main reasons for this:

  1. Later assignments in this course will assume that students are quite familiar with some of basic array operations and these assignments will be challenging in other ways. If you can't write basic 1D array operations then you will flounder when writing the code for these assignments.
  2. In the 300 level data structures and algorithms class students must not only trace or even write sorting algorithms for lists (1D array or a linked list) but they must also be able to analytically analyze their efficiency. There won't be the option to simply call a method of a prewritten class or function.
  3. You will have to learn how to do eventually: Some programming languages do not provide pre-created methods (e.g. 'append' from Python) or a plethora of predefined classes (such ArrayList from Java). In these cases the programmer will have to manually write code for operations such as displaying elements, copy all elements from one array to another etc.

Description

Implement a simple grade management program. Grades are stored as real number grade points (4.0, 3.7, 3.3...0.0). Array elements that are occupied will contain a grade within this range. For example, this array would be assumed to contain 4 grades (values outside the valid range represent 'unoccupied' elements): 3.3, 4.0, 2.7, 0, -1, -1, -1... The program includes basic statistical generation (average) and visualization of the data (query for the highest and the lowest grade). There is no requirement for including user input of the grades but the program must include the ability to initialize grades (hard-coded or random). The program will employ a text-based menu-driven interface.

Technical details

The program consists of 3 classes:

Program features

Some of the marks you are awarded will be determined by your adherence to the stylistic conventions taught in class as well your program documentation. Also all output should not only be correct but the results should be clear, reasonably neat and presentable. The real number portion of a grade should only be displayed to one place of precision (e.g. 3.0 and not 3.00). The bulk of your credit will come from implementing the following features.

  • Array has each element initialized to starting value outside the range of valid values (e.g., -1).
  • A main menu of program options is displayed: average grade, display grades, find highest, find lowest, random and fixed initialization of list, the ability to quit the program. (JT: To clarify I should have added an option to initialize the first 10 array elements as well).
  • Get user selection (of the options at the main menu).
  • Program runs until the user selects the option to quit the program (display menu, get user input, execute user selected option...this cycle repeats until the user quits).
  • Display the contents of the list (you only get credit for one version)
    
  • Basic version: displays all the grades in the list.
    
  • Advanced version: only displays list elements that contains a valid grade i.e., if the list only contains 10 grades then only the first 10 elements will be displayed. The ability to only display occupied elements should be determined by the actual number of occupied elements at run-time and not set to a hard-coded value.
  • Assign a fixed grade of 2.0 to all array elements. Previous values are overwritten.
  • Assign grades to the first 10 list element randomly. To make it simple randomly assigned grades can consist only of integer values ranging from zero to four.  Previous values are overwritten.
  • Calculate and display the average grade.
  • Determine and display the highest grade in the list.
  • Determine and display the lowest grade in the list.

UML class diagram

You should create a UML diagram for class "Manager" and class "UserInterface". All information for a class should be specified (e.g., attributes, methods, parameters, return values, permission levels). Also the relationship between the two classes include multiplicity (see the notes which introduce Object-Oriented concepts) should be specified. The class diagram can be drawn using any structured drawing program (even PowerPoint). However the diagram must be correct and it must be understandable/readable by the marker. The image that you submit via D2L must be in one of the following formats: 'gif', 'jpg', 'png' or 'pdf''. Also if the marker cannot open your file then you won't get credit (you should check it).

Marking:

Important 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. Alternate submission mechanisms (non exhaustive list of examples: email, uploads to cloud-based systems such as Google drive, time-stamps, TA memories) cannot be used as alternatives if you have forgotten to submit work or otherwise have not properly submitted into D2L. Only files submitted into D2L by the due date is what will be marked, everything else will be awarded no credit.
  2. Extensions may be granted for reasonable cases by the course instructor with the receipt of the appropriate documentation (e.g., a sworn declaration with a commissioner of oaths). Typical examples of reasonable cases for an extension include: illness or a death in the family. Example cases where extensions will not be granted include situations that are typical of student life: having multiple due dates, work commitments etc. You should mitigate the occurrence of technical problems by submitting your work early and often and early in D2L as well as performing regular backups. Do not expect to get an extension if something like this has occurred. If you request an extension from me let me know the name of your tutorial instructor and the tutorial number because the markers won't accept late submissions without directly getting an email from me.
  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. What to submit: Java programs should be submitted in the form of .java source code. Do not submit .class files.
  5. Identifying information: All assignments should include contact information (full name, student ID number and tutorial section) at the very top of your program in the class where the 'main()' method resides (starting execution point). (Note other documentation is also required for most of the full assignments).
  6. Collaboration: Assignments must reflect individual work; group work is not allowed in this class nor can you copy the work of others. Students should not see each other's graded programs (don't post it, don't email it out, don't show it in a screen share). For more detailed information as to what constitutes academic misconduct (i.e., cheating) for this course please read the following [link].
  7. Execution: programs must run on the computer science network (if applicable during that particular semester) running the latest version of Java (this is what applies for the distance learning version of the course). If there libraries or classes external to what's included in Java then you must include clear and complete instructions for your marker as to exactly what needs to be done to compile and run your submission otherwise you may be awarded no credit. Also you should be wary of using external libraries rather than writing the code yourself because you may not be awarded credit for particular features if you didn't write the code yourself. If you write you code in the lab and work remotely using a remote login program such as Putty or SSH then you should be okay (assuming you don't login to a non-Linux computer). If you choose to install Java on your own computer then it is your responsibility to ensure that your program will run properly here. It's up to you if you wish use the graphical program builder to write/run your programs but if you do you submit your program in the form of text ".java" file or files.
  8. Use of pre-created  libraries: unless otherwise told you are to write the code yourself and not use any pre-created classes. For this assignment the usual acceptable functions include code in the Scanner class and methods for displaying output such as: printf()print()println(). Also for this assignment you can use the random number generating capabilities of class Random or class Math.
  9. Late submissions Make sure you give yourself enough time to complete the submission process so you don't get cut off by D2L's deadline (when you get a zero). Unlike the mini-assignments you may be able to submit your work late and be awarded some credit.

Submission received:

On time

Hours late : >0 and <=24

Hours late: >24 and <=48

Hours late: >48 and <=72

Hours late: >72 and <=96

Hours late: >96

Penalty:

None

-1 GPA

-2 GPA

-3 GPA

-4 GPA

Submission not graded.

 

Submitting your work:

  • What to submit.
  • The document must be electronically submitted using D2L.
  • It's recommended that you submit your work early and often to avoid problems such as forgetting the due date or problems with your computer (hardware failures, malicious programs etc.). Reminder: you will not be granted special considerations such as extensions in these cases!
  • D2L configuration for this course
    • Multiple submissions are allowed for this assignment (all versions are kept in D2L): You can (and really should) submit work as many times as you wish before the due date. Due dates are strict, only what is in D2L by the deadline is what will be marked. Other methods of verifying that your work was completed on time (e.g. checking timestamps, emailed files etc.) will NOT be accepted. However only the latest version of all the files is what will be marked, everything else will be ignored (because it is not fair to your marker to sort through multiple versions of your files).
  • Do not use compression utilities (such as zip) or archiving utilities (such as tar) otherwise your submission may not be marked. The space savings in D2L is not worth the extra time required by the marker to process each submission.
  • 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 your submit your assignment with enough time before it comes due for you to do a check).