logo

Crowdly

Browser

Add to Chrome

Task Instructions Go to: Part A Part B In-Person Assessment Requirement...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

Task Instructions

Go to: Part A Part B In-Person Assessment Requirements Logic Requirements

Part A

Assessment Goals:

You will need to demonstrate:

        • a complete, functional python file that meets the logic requirements below, and meets the coding standards.
        • that you can make modifications to the python code logic if asked to do so.

Write the python functions as described in the logic requirements section below. Note that your code must meets/implements the following requirements:

        • All variables must be in lowerCamelCase style
        • Indentation must use 4 space = 1 tab style
        • Any use of 'except' must be followed by a specific error being trapped
        • All functions must have function header documentation
        • Function header documentation must be defined using docstrings on the line following the function definition and must contain the following
          • A short, two line description of the function
          • An explicit list of parameters (indicate none if there are none)
          • An explicit return (indicate none if there are none)

        • The file must have file header documentation.
        • File header documentation must be the first three lines of the file and contain the following information using the normal commenting style
          • Author name
          • Last modified date
          • File version number

You must:

      • test your code rigourously to ensure that it meets the required functionality
      • conform to the coding standards indicated above
      • only code in one python file
      • not write any additional functions

Part B

Assessment Goals:

You will need to demonstrate:

        • a clear understanding of the python code and how it works during the interview.

You should:

      • Ensure that you have a good understanding of your work.

In-Person Assessment Requirements

You must bring:

      • your completed code (as a .py file) on your computer

At the assessment:

      • your assigned group and start time is listed on Moodle. Make sure you show up at the beginning of your timeslot.

      • queue quietly along the opposite wall to the doors. Leave a gap for any door or exit (i.e. do not block doors).

      • if we are running late and you need to go for some reason, make this known to us before leaving.

Logic Requirements

Write a python program to calculate the penalty for speeding in Victorville using the conditions in the table provided below. Note that the conditions in the table shown are not in the correct sequence - conditional statements must be written in the right order, so make sure you read all of the conditions and then decide on the most appropriate order for them.

Your program will need to contain two sections, a main() function and a calc_penalties() function.

main()
The main() function has no parameters and contains the logic as follows:

    1. Ask the user if they are driving a heavy vehicle or not
    2. Ask the user for the road speed limit in km/h (integer values only)
    3. Ask the user for their vehicle speed in km/h (any numerical values accepted - cast to float)
    4. Perform the required validation for the three items above to ensure that the user only provides valid values. If an invalid input was provided, the program should print an appropriate error message and ask the user for a new value for that input.
    5. Call the calc_penalties() function and provide the inputs above as parameters
    6. Using the dictionary returned by the function calc_penalties(), print the following information out appropriately (e.g. if no penalties apply, you should state so)

      • The vehicle overspeed value in km/h to one decimal place
      • Any penalties that apply (only show the penalty that applies)

    1. Then, ask the user if they would like to check for another vehicle (Y/N)
      1. If they respond with 'Y', restart the program
      2. If they respond with anything else, restart the program

At any time, if the user hits CTRL+C (Keyboard Interrupt), the program should end after printing 'Exiting program now'.

calc_penalties()

The calc_penalties() function has the three parameters vehType, roadSpeed, speedLimit:

      • vehType should be a boolean variable containing True if the vehicle is heavy.
      • roadSpeed should be an float variable containing the vehicle speed.
      • speedLimit should be a integer variable containing the road speed limit.

The function should contain the logic as follows:

    1. Determine the overspeed value which is calculated by taking the vehicle speed and subtracting the road speed limit from it.
    2. Using the tables below, determine the appropriate penalties that apply. In determining penalties, you should round the overspeed value down to the nearest integer (i.e. 23.95 rounds down to 23.0).
    3. If the vehicle is not speeding (overspeed <= 0), the dictionary should return 0 for overspeed with appropriate values for penalties.
    4. Return a dictionary containing the keys as follows:

      • overspeed: float value containing the original overspeed value calculated
      • penalties: a list containing the following three values - demerits (integer), suspension (integer), fines due (float).

Penalties for speeding offenses (except heavy vehicles)

Exceeding the speed limitPenaltyDemerit points

Automatic licence suspension
By less than 10 km/h$247.001 -  
10 km/h to under 25 km/h$395.003 -  
25 km/h to under 30 km/h$543.00 - 3 months
30 km/h to under 35 km/h$642.00 - 3 months
35 km/h to under 40 km/h $741.00 -  6 months
40 km/h to under 45 km/h $840.00 -  6 months
By 45 km/h or more $988.00 -  12 months
10 km/h to under 25 km/h (only if speed limit is > 100km/h)$395.00 -  3 months

Penalties for speeding offenses - heavy vehicles

Exceeding the speed limitPenaltyDemerit points

Automatic licence suspension
By less than 10 km/h$3241 -
10 km/h to under 15 km/h$5093 -
15 km/h to under 25 km/h$7403 -
25 km/h to under 30 km/h$1,017-3 months
30 km/h to under 35 km/h$1,294-3 months
35 km/h to under 40 km/h$1,572-6 months
40 km/h to under 45 km/h $1,849- 6 months
By 45 km/h or more$2,127-12 months
10 km/h to under 25 km/h (only if speed limit is > 100 km/h)$740-3 months

More questions like this

Want instant access to all verified answers on learning.monash.edu?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome