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

 

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

Write a method that performs the indicated 'operation' on two integers 'num1' and 'num2'. Valid operations are "+", "-", "*", and "/". As a precondition you may assume that 'operation' will be one of these operations and that if the operation is "/" 'num2' will not be zero. Also, the division operation will result in integer division because the method returns an integer. Look at the test data for examples.


dec15_2016_APSLHL_calculate(325, "/", 5) → 65
dec15_2016_APSLHL_calculate(70, "*", 2) → 140
dec15_2016_APSLHL_calculate(1, "*", 1) → 1

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

public int dec15_2016_APSLHL_calculate(int num1, String operation, 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: 210

Copyright Nick Parlante 2017 - privacy