Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Speeding Fines Current penalties for individuals caught speeding in Queensland are: table [ [ Infringement , Penalty amount,Demerit points ] , [ Less than

Speeding Fines
Current penalties for individuals caught speeding in Queensland are:
\table[[Infringement,Penalty amount,Demerit points],[Less than 11kmh over the speed limit,$309,1],[At least 11kmh but not more than 20kmh over the speed limit,$464,3],[More than 20kmh but not more than 30kmh over the speed limit,$696,4],[More than 30kmh but not more than 40kmh over the speed limit,$1,161,6],[More than 40kmh over the speed limit,$1,780,8]]
Note: the way the government website has written this (and we've copied it) is NOT efficient in terms of decision structures. This has been written for each condition to stand alone (if, if, if) but we can tell this is mutually exclusive, so we know a better tool for the job, don't we?
Avoid a 6-month suspension by writing a program to ask for the user's:
speed and the
speed limit
then tell them their fine in dollars (you can ignore the demerit points).
After getting the inputs, you will want to calculate the speed over the limit. You do not want to calculate this again and again in each condition. DRY.
Before you finish this question, check again for any "DRY" issues.
Can you improve your code?
Plays Used python
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Database Systems For Integration Of Media And User Environments 98

Authors: Yahiko Kambayashi, Akifumi Makinouchi, Shunsuke Uemura, Katsumi Tanaka, Yoshifumi Masunaga

1st Edition

9810234368, 978-9810234362

Students also viewed these Databases questions