0

What can l do if l am creating a simple calculator class that prompt user to input operater and perfom operation?

l have write addition,subtraction,division and multiplication methods .And another method "user_choose_operation" simulating calculator class to prompt user to input operation either addition ,subtraction, division and multiplication. But now l'm stuck, l want ,if the user input "addition" then the method "user_choose_operation" must pass information to addition method.

18th Mar 2017, 7:49 PM
Adroit Joshua Tsaura
Adroit Joshua Tsaura - avatar
3 Antworten
+ 1
use the many tutorials here as a base to set up your program, and for user choosing operation a multiple choice question with a switch case would be easiest if you aren't implementing GUI
18th Mar 2017, 8:14 PM
William La Flamme
William La Flamme - avatar
+ 1
yea just have it call a function to clear choice and start over in each case statement after it returns the output
18th Mar 2017, 10:13 PM
William La Flamme
William La Flamme - avatar
0
Thanks bro ! You are right,l need to switch to another method ,but few minutes earlier l was trying return keyword but l see that it can't switch to another method.
18th Mar 2017, 8:19 PM
Adroit Joshua Tsaura
Adroit Joshua Tsaura - avatar