Question: Write a program that is given two integers representing a speed limit and driving speed in miles per hour ( mph ) and outputs the
Write a program that is given two integers representing a speed limit and driving speed in miles per hour mph and outputs the traffic ticket amount. We will need to use a series of ifelifelifelifelse statements to complete this program. You will be comparing the difference driving speed speed limit to each condition below
These are the conditions take your time and do them one by one!:
Driving faster than mph over the speed limit receives a $ ticket.
Driving mph over the speed limit receives a $ ticket.
Driving mph over the speed limit receives a $ ticket.
Driving mph under the speed limit or slower receives a $ ticket.
Otherwise, no ticket is received.
Ex: If the input is speed limit and then driving speed:
the output is:
because the driver was driving miles over the speed limit which falls in between miles over the speed limit
Ex: If the input is:
the output is:
because the driver was driving miles under the speed limit which means no ticket is issued.
Ex: If the input is:
the output is:
because the driver was driving miles over the speed limit which falls in between miles over the speed limit
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
