Consider the following scenario: You might have been driving a little too fast when a police officer
Question:
Consider the following scenario:
You “might” have been driving a little too fast when a police officer stops you. Write code to determine the type of ticket you are to receive and the charge of the ticket. The requirements are as follows:
Define a function called: police
The function should receive 2 arguments: speed, bday speed should receive the speed of the vehicle from the police officer’s perspective bday should be a Boolean as to whether it is your birthday or not
If the speed is 60 or less, the result is a “warning” ticket. If speed is between 61 and 80 inclusive, the result is a “speeding” ticket. If speed is 81 or more, the result is an “excessive speeding” ticket. Unless it is your birthday -- on that day, your speed can be 5 higher in all cases.
Speed < 0 should provide the message 'Speed can not be negative.'
Speed >= 150 should provide the message ''Where's the fire! You're going downtown, Flash!'' For speeding tickets, for every mile an hour over the speed limit, a $10 charge is given.
For excessive speeding tickets, for every mile an hour over the speed limit, a $15 charge is given. The output statement should be from one print statement.
Understanding Business Ethics
ISBN: 9781506303239
3rd Edition
Authors: Peter A. Stanwick, Sarah D. Stanwick