id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

frew@mclean.com apcs2026unit2if2 > speedingFine
prev  |  next  |  chance

Goal: Calculate the dollar amount of a traffic ticket based on speed and zone type. Rules: In a regular zone (isSchoolZone is false): Speed 1–10 mph over limit: $50 Speed 11+ mph over limit: $100 In a school zone (isSchoolZone is true): All fines double! (Speed 1–10 mph over = $100, 11+ mph over = $200). Special rule: If speed is not over the limit (0 or less mph over), the fine is $0 in all zones.


speedingFine(-5, false) → 0
speedingFine(-5, true) → 0
speedingFine(0, false) → 0

...Save, Compile, Run (ctrl-enter)

public int speedingFine(int speedOver, boolean isSchoolZone) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 200

Copyright Nick Parlante 2017 - privacy