Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Database Principles Programming And Performance

Authors: Patrick O'Neil

1st Edition

1558603921, 978-1558603929

More Books

Students also viewed these Databases questions