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

 

zbaharav@kehillah.org warm-up1 > kLottery
prev  |  next  |  chance

Kehillah lottery ticket has three integers printed on it: a, b, and c. You win according to the following rules, checked sequentially in order: 1. If two numbers or more are the same, and all the numbers are above 10, you win $20. 2. If three numbers are the same, and are below 15, you win $40. 3. If all numbers are different, you win $30. Otherwise, you do not win anything. Write a function that returns your winnings.


kLottery(27, 27, 30) → 20
kLottery(27, 27, 9) → 0
kLottery(28, 28, 28) → 20

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

public int kLottery(int a, int b, int c) { }

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: 100

Copyright Nick Parlante 2017 - privacy