1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- //import java.math.Double;
- import java.math.*;
- /**
- * This class handles factorials and Logarithmic functions
- */
- public class BonusFeatures
- {
- // instance variables - replace the example below with your own
- Console console = new Console();
-
-
- /**
- * Constructor for objects of class BonusFeatures
- */
- public BonusFeatures(Console c)
- {
-
- console = c;
- }
-
- public Double factorialOf(Double value){
- Double f = 1.00;
- value = Math.floor(value);
- for(double i = 1; i <= value; i++)
- f *= i;
-
- return console.currentValue = f;
- }
-
- public double logarithm(Double value){
-
- return console.changeCurrentValue((double)Math.log10(value));
- }
-
- public Double invLogarithm(Double value){
-
- return console.changeCurrentValue(Math.pow(10.00,value));
- }
-
- public double lnLogarithm(Double value){
-
- return console.changeCurrentValue((double)Math.log(value));
- }
-
- public double expLogarithm(Double value){
-
- return console.changeCurrentValue((double)Math.exp(value));
- }
- }
|