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

 

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

Write a method that returns the sum of two integer input parameters 'num1' and 'num2', but ONLY if 'num2' is greater than 'num1'. If 'num2' is equal to 'num1' or less than 'num1', just return the value of 'num1'. Look at the test data for examples. Remember, you must only use ONE return statement per method.


practiceQuiz2021_08_30_APSLHL_maybeAdd(5, 6) → 11
practiceQuiz2021_08_30_APSLHL_maybeAdd(5, 3) → 5
practiceQuiz2021_08_30_APSLHL_maybeAdd(8, 10) → 18

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

public int practiceQuiz2021_08_30_APSLHL_maybeAdd(int num1, int num2) { }

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

Copyright Nick Parlante 2017 - privacy