SCHOOL OF COMPUTING, ENGINEERING & MATHEMATICS 300581: Programming Techniques
Spring 2019: Programming Project
Due by 7:00 pm on Friday 18th October 2019 Assessment Weight: 40%
This document has six (6) pages. b) This assignment is NOT a group assignment; collusion, plagiarism, cheating of any kind is not acceptable. As part of your submission, you MUST certify that all work submitted is your own. If you cannot honestly certify that the work is your own then do not submit the assignment. Breaches of the Misconduct Rule will be dealt with according to the university Rule (see the learning guide for more information). c) All assignment submissions will be checked for academic misconduct by the use of the MOSS program from Stanford University. Details on MOSS can be obtained from the MOSS web site http://theory.stanford.edu/~aiken/moss/
For the problem definition described in section B you must d) include your student id at the end of all filenames for all java code files. Two classes have been identified in section B as being required as part of your solution. Do not modify the names of these classes except for adding your student id to the end of the filename. Other Java files will be needed as part of your solution. All Java code files that are used in this assignment MUST have your student id appended to the filename. For example, Driver_########.java; e) include your authorship details at the top of each file in code comments (see item 3.1 in Section C of this document
for details); f) adhere to the coding standard as identified in the Google Java Style Guide (see Section C of this document for
details); g) ensure that standard console Input/Output are used in all code segments, do not use Swing; h) ensure that your java code is appropriately modularised for the given problem definition. That is, you need to write
appropriate classes and methods to solve the problem; i) reference all sources that you used for inspiration of your solution as per Section D of this document; j) Ensure that your java code compiles and runs in Eclipse installed in the SCEM labs.
B(i) - Background information and description The Police regularly patrol the roads to deter and detect dangerous driving. There are heavy penalties, including demerit points, fines and on-the-spot licence suspensions, for drivers who break the law1. As an unrestricted-licence driver in NSW you start with zero demerit points. If you commit an offence that has a demerit point penalty, they are then added to your driving record. If you reach or exceed the maximum demerit points allowable for your licence within a 3-year period, your licence will be suspended2. Unrestricted NSW driver licence holders who reach or exceed 13 demerit points are sent a Notice of Suspension, or are refused a licence if they apply to renew one3. Driving offences include, but are not limited to, alcohol and drug offences, heavy vehicle offences, motorcycle offences, seat belt and child restraint offences, speeding, street racing, unlicensed driving4.
In this assignment, you will create an object-oriented, menu-driven Java program that implements a simplified range of functionalities relating to infringements for speeding offences and the resulting demerit point calculations. The Java program will retrieve data from secondary storage, store the data in memory in appropriate data structures using objects, sort and search the data, generate on-screen and file-based reports, and save data to secondary storage. The specific functional requirements for the assignment are described in section B(ii) of this document. The text files that are to be used for this assignment are described in section B(iii). The classes that must be used as a minimum are described in section B(iv).
B(ii) - Program Requirements/Functionality The Java program must
needed to solve the program requirements; b) be menu-driven. The main menu must have the following menu items:
Program Start-Up When the java program starts it must perform the following file-related operations: d) Read the data from the Driver.txt file into computer memory into an appropriate array of objects (see section B (iii) for a description of the Driver text file and section B (iv) for a description of the Driver class). If the Driver file does not exist then the user should be informed of this and given the opportunity to provide an alternative filename that contains the Driver data;
After processing the Driver.txt file the program should display the main menu identified in section B(ii)(b) above.
Main Menu Item Functionality The required functionality for each menu item is described as follows:
Extension Activity: As an extension to the stated on-screen list, provide the user with the option to display the report in descending-order of the Demerit Points.
Page 2 of 6
B(iii) - Text files to be processed The data that is to be manipulated by your Java program for this assignment is contained in the text files driver.txt, and infringements#.txt. Examples of these text files are found in the zip file for the assignment. The data within these text files will need to be read into memory by your program so that it may be manipulated to solve many aspects of the required functionality of the assignment. The text files have been created to conform to a particular format. The format for each file is described below:
File: driver.txt This file contains a full record of unrestricted NSW driver licence holders. Each line within the file represents an individual driver, and has the following format:
Licence Number, Licence Class, First Name, Last Name, Address, Suburb, Postcode, Demerit Points, Licence Status
where each data item is separated by a comma (,). The following table provides a brief explanation of each of these data items:
Data Item Explanation Extra Notes Licence Number the driver’s licence number Licence Class the class of licence Possible values are C, R, LR, MR, HR, HC, MC5 First Name the driver’s first name Last Name the driver’s surname Address the driver’s home address Suburb the driver’s home suburb Postcode the driver’s home postcode Demerit Points the driver’s current accumulated
refer to section B(i) for description of how demerit points work in NSW Licence Status the status of the driver’s licence values are either “Valid” or “Suspended”
File: infringments#.txt There are multiple infringement files which are numbered in sequence. These files contain a record of infringements for drivers that have committed a speeding offence that has a demerit point penalty. Each line within the files represent an individual infringement for a driver. A driver may possibly receive more than one infringement if they have been booked for speeding more than once. If a driver has not received an infringement then there will not be any infringements in the files (ie, not all drivers will appear in the files). Each infringement file has the following format:
Infringement Number, Licence Number, Date of Infringement, Excess Speed
where each data item is separated by a comma (,). The following table provides a brief explanation of each of these data items:
Data Item Explanation Extra Notes Infringement Number a unique numeric identifier for the
infringement Licence Number the drivers licence number The licence number may not match any
of the drivers in the driver records. See note 2 below for further detail Date of Infringement the date when the infringement occurred Excess Speed the number of km/h above the speed limit
Multiple infringements.txt files will be provided over time in vUWS. Each file represents a different set of infringements and can be applied to the driver record sequentially. That is, infringements1.txt corresponds to infringements that were issued in period 1, infringements2.txt corresponds to infringements that were issued in period 2, infringements3.txt corresponds
Page 3 of 6
to infringements that were issued in period 3, and so on. These three files would be applied to the driver records separately but in the sequence 1, 2, 3 based upon the program operator’s choice of file to process.
Notes: 1. As indicated in Program Start Up, when reading the Driver text file into memory the data should be read into appropriate array of objects. The classes for these objects are briefly outlined in section B(iv). 2. As indicated in the table above, the licence number in the infringement file may not match any of the drivers in the loaded driver records. This may occur for different reasons such as the driver holding a non-NSW licence, or an error in recording of the licence number. 3. We will use different sets of data for marking; the number of lines of data, and the data values in the text files will be different from those supplied with the assignment. This is to ensure that your solution has not relied upon specific data values or the number of lines in the text files to work. You should therefore test your program with different data files of varying length and varying data before submission.
B(iv) - Required Classes To write your solution for this assignment it is a requirement that you write appropriate code for at least the following java Classes:
These classes are described in general terms as follows:
The following is a tabular representation of the data in the four arrays in the SpeedingPenalty class that may assist you to understand the relationship between the arrays and the data:
Excess Speed (km/h) Demerit Point
Fine Automatic Licence
Suspension Exceed speed limit by more than 0 km/h 1 $360.00 No (false) Exceed speed limit by more than 10 km/h 3 $481.00 No (false) Exceed speed limit by more than 20 km/h 4 $599.00 No (false) Exceed speed limit by more than 30 km/h 5 $1441.00 Yes (true) Exceed speed limit by more than 45 km/h 6 $3762.00 Yes (true)
Each of the arrays in the class have been initialised with the values shown in the table above; do not change the arrays in any way. Each of the arrays run in parallel to the others in the class. That is, if we know the excess
Page 4 of 6
speed for an infringement then we can determine the demerit points, fine, and whether the licence is automatically suspended by looking at the corresponding element in the other arrays. The following examples illustrate this idea.
Example 1: if a driver is booked driving at 10 km/h over the speed limit then the penalties would be loss of 1 demerit point and a fine of $360. Example 2: If a driver was booked driving at 22 km/h over the speed limit then the penalties would be loss of 4 demerit points and a fine of $599. Example 3: If a driver was booked driving at 46 km/h over the speed limit then the penalties would be loss of 6 demerit points, a fine of $3762 and automatic suspension of licence.
Since the SpeedingPenalty class is meant to be a utility class and its data fields and methods are static, constructors and mutators are not needed. However, you will need to implement appropriate accessors where necessary and other appropriate static methods for this class based upon the general requirements of the assignment specification. A method called findPenaltyIndex has been supplied in the class; do not change this method in anyway. This method finds the index of the Excess Speed value in the ExcessSpeed array. This value can then be used by other methods to determine the corresponding penalties for the infringement.
Apart from the two classes identified above it is possible that you may also need to write other classes depending upon your solution method.
Style Guide Item Number
Changes to Modification
2.1 to 2.3 2.1 modified 2.1 - File Name: The source file name consists of the case-sensitive
name of the top-level class it contains as identified in the question, plus an underscore, plus the student ID, plus the .java extension Example: Driver_12345678.java
3.1 to 3.4.1 3.1 modified 3.1 – License Info is replaced by Authorship information
All java source files must contain the authorship information as follows: Student ID: Name: Campus: Tutor Name: Class Day: Class Time:
4.1 to 4.7, 220.127.116.11 to 18.104.22.168, 4.8.4 to 22.214.171.124, 4.8.6
5, 5.1 to 5.3 NIL
Note: The zip file must be named according to the naming convention
where studentid is your student id, and StudentName is your full name, TutorsName is the name of your tutor. 2. Upload the above zip file in vUWS in the Project Submission link provided.
Page 5 of 6
The marking criteria and standards for the assignment are published on pages 11-14 of section 2.5.2 in the Learning Guide and will be used to assess your assignment submission according to the specific weightings identified in the table below
55% Code Documentation: 5%
Class Construction 15% Identifier Use: 5%
Algorithm Selection: 15% Code Readability: 5%
Page 6 of 6
CS 340 Milestone One Guidelines and Rubric Overview: For this assignment, you will implement the fundamental operations of create, read, update,
Retail Transaction Programming Project Project Requirements: Develop a program to emulate a purchase transaction at a retail store. This
7COM1028 Secure Systems Programming Referral Coursework: Secure
Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip
CS 340 Final Project Guidelines and Rubric Overview The final project will encompass developing a web service using a software stack and impleme