Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python Assignment 3; Decision Structures (Decision Tree: If elif else loop) The fines for Speeding in one of the counties in Florida is given in

python
image text in transcribed
image text in transcribed
image text in transcribed
Assignment 3; Decision Structures (Decision Tree: If elif else loop) The fines for Speeding in one of the counties in Florida is given in the following table. Use if elif else decision structure. If the driver is driving greater than or equal to 40mph over the speed limit, fine is calculated as $0.00 and Court Mandatory message should be displayed as shown in the table above. Write a Python program to calculate the speeding fine and the output message displayed on the traffic ticket as given below in the second table. (50) Create a function def Yourfirstname_Speeding_Fines 0 : instead of def main(5). (In this case you can use the same function name Yourfirstname_Speeding_Fines 0 at the end of the file to execute the function like you did with maino) Create the filename also same name as the function - Yourfirstname_Speeding_Fines0.py The following three variables in the program should be named as given below and should be input by the user: speedLimit_zone_lastname //(Speed Limit of the zone: can be an integer) speed veh lastname // (Speed of the vehicle: can be an integer) driv_zone_lastname // ( A string data type) The question here is where the ticket is issued. Zone Input has to be one of these eight values. " R ". " S ". "W" or " H"OR " r","s"." " or " h" ". R or r-Regular Sors-School Wor w - Workers Present Hor h-Housing Development If the input is not one of these eight values print a message saying that invalid zone and let the user know that this will be considered as a S or s (school zone). If the driv_zone_lastname is R or r (Regular zone) the fines from the table are used. If the driv_zone_lastname is S or s (school zone) the regular fines are tripled. If the driv_zone_lastname is Wor w (Workers' zone) the regular fines are doubled. If the driv_zone_lastname is H or h (Housing zone) the If the driv_zone_lastname is H or h (Housing zone) the regular fines are 1.5 times . (15) The program also should display the following message for each of the above cases as shown in the table below: (8) Greater than or equal to 40 MPH See Ya in Courn: Display also should specify which zone the driver was driving in. Your function should calculate the fine and should do the display. Function should not calculate any fine if the driver is driving within the speed limit with a message. "You are a good Driver." (10) As usual submit your program in a zip file with the header comments (Your name, assignment no., file name and file version and what the program does) and other comments. (12) (Following are examples which you can use for testing. Please do not code for these values. Program should be always general.) For example your output should look like ( what is shown Bold below ): \#Case 1: When Driving in Regular zone Speed Limit: 45 Vehicle speed: 57 Driv_Zone: R Total Fine Calculated =$99.00 Display: Caution- Reduce Speed ! \#Case 2: When Driving in School zone Speed Limit: 45 Vehicle speed: 57 Driv_Zone: S Total Fine Calculated =$297.00 Display: Caution- Reduce Speed ! \#Case 3: When driving in Workers present Zone Speed Limit: 45 Vehicle speed: 57 Driv_Zone: w Total Fine Calculated =$198.00 Display: Caution- Reduce Speed ! \#Case 4: When driving in a housing development Speed Limit: 45 Vehicle speed: 57 Driv_Zone: h Total Fine Calculated =$148.50 Display: Caution- Reduce Speed ! (Following are examples which you can use for testing. Please do not code for these values. Program should be always general.) For example your output should look like ( what is shown Bold below ): \#Case 1: When Driving in Regular zone Speed Limit: 45 Vehicle speed: 57 Driv_Zone: R Total Fine Calculated =599.00 Display: Caution- Reduce Speed ! \#Case 2: When Driving in School zone Speed Limit: 45 Vehicle speed: 57 Driv_Zone: S Total Fine Calculated =$297.00 Display: Caution- Reduce Speed ! \#Case 3: When driving in Workers present Zone Speed Limit: 45 Vehicle speed: 57 Driv_Zone: w Total Fine Calculated =$198.00 Display: Caution- Reduce Speed ! \#Case 4: When driving in a housing development Speed Limit: 45 Vehicle speed: 57 Driv_Zone: h Total Fine Calculated =$148.50 Display: Caution- Reduce Speed ! \#Case 5: When driving in regular zone with a different speed Speed Limit: 35 Vehicle speed: 44 Driv_Zone: r Total Fine Calculated =$49.50 Display: Please Slow Down ! \#Case 5: When driving in regular zone with a different speed Speed Limit: 45 Vehicle speed: 88 Driv_Zone: r Total Fine Calculated =$0.00 Court Mandatory - Fine decided in court. Display: See Ya in Court

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2017 Skopje Macedonia September 18 22 2017 Proceedings Part 3 Lnai 10536

Authors: Yasemin Altun ,Kamalika Das ,Taneli Mielikainen ,Donato Malerba ,Jerzy Stefanowski ,Jesse Read ,Marinka Zitnik ,Michelangelo Ceci ,Saso Dzeroski

1st Edition

3319712721, 978-3319712727

More Books

Students also viewed these Databases questions