Aim
This assignment is intended to assess your skills in understanding and interpreting a moderately complex problem, designing a solution to the problem and implementing the design using principles of correct syntax, layout, and program structure.
Instructions
This assignment is a group assignment.
Note:It is your responsibility to clarify any aspect of the assignment of which you are unsure with your lecturer. Where you have used example code and modified it, you must reference the source.
You will be asked to demonstrate your work to your lecturer in the week of the due date. There will be a range of appointment times and you can choose your time. All assignments must be demonstrated otherwise they will not be marked.
Tasks
- Read the scenario and program specifications. Determine the functions required.
- Determine the logic for each of the option functions in the UI.
- Prepare a Complete Flow Chart for the Project
- Write the code for the module. You may wish to test each of the major functions before writing the next, so that the same mistake is not repeated in multiple functions.
- Demonstration of the Code
Scenario
Speeding fines increase progressively from $30 for speeds less than 10 km/h over the limit, to a maximum fine of $630 for speeds up to 50km/h over the limit.
At more than 40 km/h above the speed limit you could also get a 28-day licence suspension.
At more than 50 km/h over the limit you could be charged with careless, dangerous or reckless driving.
Write a program to
1. Create a dictionary to store the following information to a txt file:
Location
|
Limited Speed
|
Queen St
|
30
|
Carlisle Rd
|
50
|
East Coast Rd
|
50
|
Ponsonby Rd
|
40
|
Lake Rd
|
50
|
Onewa Rd
|
50
|
2. accept a value for the speed limit for the selected stretch of road
3. then, within a loop:
4. get the clocked speed of each car as it passes the radar gun (this value is inputted by the user each time).
5. calculate and print either that the speed was legal, or print the invoice of the fine, or print an error message (Constraints: the speed radar cannot cope with speeds under 1 (car is stationary or reversing, or over 180 (outside technical capabilities). In either situation, print out an error message, but do not process it.)
6. store the speeding information (including name, fine, and time) in a txt file (Create another option to store the information into a txt file, or store them while quitting the application)
7. allow police to check speeding ticket by name
Program Specifications
When the program starts:
- Display the welcome message.
- Initialize information of limited speed on different roads and records them into a dictionary.
- Display the main menu and wait for the user to enter an option.
Sample screen (the number of records shown is a sample only):
Welcome to Auckland Speed Gun System:
1. List road name and speed
2. Search speed limit for a road
3. Input speeding ticket
4. Display a speeding ticket
5. Display all speeding ticket(s)
6. Exit
Please select one option from menu:
Option 1: List road name and speed
This option allows users to view all the roads in the system. When this option is selected:
- If the number of road records is greater than 0:
- Display the heading "******** Road Information ********"
- Display the column headings
- Display each road information in the format to fit the column headings
Option 2: Search speed limit for a road
This option enables the users to view all the details of the road. When this option is selected:
- Display the heading "******** ROAD DETAILS ********" -Ask the user to enter a road name.
- Search for the road.
- If the road name exists, display
The limit speed of xx(road name) Rd is xx(limited speed).
- If the road name does not exist, output a message saying that there is no such road in the system.
- Ask if the user wants to view another road detail. (Prompt user again for a road name until they enter ‘n' to exit this option)
Option 3: Input speeding ticket(s)
This option allows users to input the oldest employer(s). When this option is selected:
- Output the heading "******** INPUT SPEEDING TICKET(S) ********"
- Input name.
- Input speed.
- Store them in a dictionary.
- Ask if the user wants to input another speeding ticket. (Prompt user again for a road name until they enter ‘n' to exit this option)
Option 4: Display a speeding ticket
This option enables the users to view all the details of the road. When this option is selected:
- Display the heading "******** Ticket DETAILS ********"
- Ask the user to enter a name.
- Search for the name.
- If the name exists, display
a) Name
b) Speed
c) Fine
If the name does not exist, output a message saying that there is no such person in the system.
Ask if the user wants to view another ticket. (Prompt user again for a road name until they enter ‘n' to exit this option)
Option 5: Display all speeding ticket(s)
This option allows users to view all the jobs in the system. When this option is selected:
- If the number of job records is greater than 0:
- Display the heading "******** ALL TICKETS ********"
- Display the column headings
- Display each ticket in the format to fit the column headings
Option 6: Exit
This option quit the system. When selected:
- Display the "Thank you" message.
- Terminate the program.
** Need Only Flow chart - Option 4 to 6
Attachment:- Program Specifications.rar