Dofactory.com
Dofactory.com
 Back to list
Views:   5.1K
Replies:  1
Archived

Series of Add/Subtract/Multiply

Hi , 

            i am building a function , where i get an amount , i need to go to series of seven steps (only 7 not dynamic). Each of this step will do Step1 - add, Step2- Multiply , Step3 - Subtract  .... till Step 7 . The compute operation is also earlier known

Can i use some pattern for this problem?

e.g   ; Input 5000

Step 1 : 5000 + 1000 = 6000

Step 2: 6000 * 2 = 12000

Step 3 12000 - 10000 = 2000

-
-
Step 7 - Final Output

Thanks
Thomson
Thomson Jacob, Apr 23, 2015
Reply 1
You may use Interpreter pattern.

Thanks,
Sandeep Mittal
Sandeep Mittal, Apr 28, 2015
Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Cookies       Do Not Sell       Licensing      
Made with    in Austin, Texas.  - vsn 44.0.0
© Data & Object Factory, LLC.