Question: Create a Java class that implements the following: You are driving a little too fast, and a police officer stops you. Write code to compute

Create a Java class that implements the following:

You are driving a little too fast, and a police officer stops you. Write code to compute the result, encoded as an int value: 0=no ticket, 1=small ticket, 2=big ticket. If speed is 60 or less, the result is 0. If speed is between 61 and 80 inclusive, the result is 1. If speed is 81 or more, the result is 2. Unless it is your birthday -- on that day, your speed can be 5 higher in all cases.

Declare appropriate variables.

Display a short message informing the user about the purpose of this class.

Provide appropriate instructions to the user for input values

Display the result based on the resulting int value.

Example:

Speed: 75

Birthday: false

Output: Small Ticket

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!