You are driving a little too fast, and a police officer stops you. Write code to compute the result, encoded as an int v

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

You are driving a little too fast, and a police officer stops you. Write code to compute the result, encoded as an int v

Post by answerhappygod »

You Are Driving A Little Too Fast And A Police Officer Stops You Write Code To Compute The Result Encoded As An Int V 1
You Are Driving A Little Too Fast And A Police Officer Stops You Write Code To Compute The Result Encoded As An Int V 1 (76.65 KiB) Viewed 68 times
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 fine, 1 = small fine, 2 = big fine. If speed is 36 or less, the result is 0. If speed is between 37 and 70 inclusive, the result is 1. If speed is 71 or more, the result is 2. Unless it is your birthday -- on that day, your speed can be 5 higher in all cases. caughtSpeeding(35, false) — 0 caughtSpeeding(41, false) = 1 caughtSpeeding(41, true) - 0 For example: Test Result System.out.println(caughtSpeeding(58, false)); 1 Answer: (penalty regime: 0, 10, 20, 50, ... %) Reset answer 1 public int caughtSpeeding(int speed, boolean isBirthday) { 2 // TODO your code goes here 3)
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply