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

 

jebbert@volusia.k12.fl.us > quizProg3P1
prev  |  next  |  chance

Write a method that accepts two integer parameters 'a' and 'b', and a boolean parameter 'add'. If 'add' is true, return the sum of the two integers, but otherwise return their difference.


quizProg3P1(5, 7, true) → 12
quizProg3P1(14, 2, false) → 12
quizProg3P1(2048, 48, false) → 2000

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

public int quizProg3P1(int a, int b, boolean add) { }

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