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

 

siochi@cnu.edu > evalThisExp
prev  |  next  |  chance

Write a method named evalThisExp which performs the indicated math operation on the two numbers. For example, evalThisExp('+', 2, 3) calculates 2 + 3 and returns the result. The allowable operations are '+', '-', '*', '/', and '%'. You can assume that only those characters will be used.


evalThisExp("+", 3, 2) → 5
evalThisExp("-", 3, 2) → 1
evalThisExp("*", 3, 2) → 6

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

public int evalThisExp(char op, int n1, int n2) { }

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

Copyright Nick Parlante 2017 - privacy