Sunday 15 September 2013

using methods and constructors to construct a basic calculator in java -


I want to come up with a simple original calculator but I want to work with the following constructor and methods

< Pre> simpleCalc (); Simple Crank (Double Op 1, Double Op 2); Double joints (); Double joints (double op1, double op2); Double multi (); Double multi (double op1, double op2); Double XP (); Double Exp (double op1, double op2); Zero show (); Zero show (int.dp); Methods should do the following: Constructor, SimpleCrack, Calculator should start with Operand (if provided - otherwise, this starts for 0 and 1, respectively). ; To add, additional operations should be done on operand (provided), store results and return; Multi should perform multiplication operations on operand (rendering), the result should be returned and returned; Expand should execute exponentiation operations on opandend (op1 ^ op2), return stores and results; The show should be printed in the calculator in the current decimal decimal places (default: 2 DP).

Any ideas on how to implement it

It looks like homework .

You are going in the right direction, however, you are not accumulating anything, as you say in the introduction, without the arguments your operations really do not work. >

As I understand, you can create a new calculator with default values ​​0 and 1 or with custom values. However, once you call calc.add (1,3); The calculator should save the values ​​of 1 and 3 so that when you call calc.mult (), they will multiply these values.

You will need to store values ​​in some way. I'm going to say this for now.


No comments:

Post a Comment