CustomFeatures.java 3.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /**
  2. * CustomFeatures found here.
  3. *
  4. * @author (David Thornley)
  5. * @version (0.1)
  6. */
  7. public class CustomFeatures
  8. {
  9. // instance variables - replace the example below with your own
  10. Console console = new Console();
  11. public String help = "";
  12. /**
  13. * Constructor for objects of class CustomFeatures
  14. */
  15. public CustomFeatures(Console c)
  16. {
  17. console = c;
  18. }
  19. public double addFive () {
  20. return console.changeCurrentValue(console.getCurrentValue() + 5);
  21. }
  22. public String helpMe () {
  23. return help = "Welcome to the help file! \n" + " \n" +
  24. "All of the available commands are listed below \n" +
  25. "with a short description for each command. \n" + " \n" +
  26. "Basic Commands: \n"+
  27. "getValue -> shows you the current stored value in the calculator \n" +
  28. "clear -> resets the current value to 0 \n" +
  29. "changeValue -> sets the current value to a user defined number \n" +
  30. "add -> adds current value to a user defined number \n" +
  31. "subtract -> subtracts a user defined number from the current value \n" +
  32. "multiply -> multiplies the current value by a user defined number \n" +
  33. "divide -> divides current value by a user defined number \n"+
  34. "square -> squares the current value (current value to the 2nd power) \n" +
  35. "SQRT -> calculates the square root of the current value \n" +
  36. "inverse-> calculates 1/(current value) \n" +
  37. "invert -> switches value of current value to negative or vice versa \n" +
  38. "variableEx -> calculates the current value to the user defined power \n" +" \n" +
  39. "Scientific Commands: \n" +
  40. "switchDisplayMode -> changes display mode to binary, octal, decimal, hexadecimal \n" +
  41. "M+ -> Add the currently displayed value to the value in memory \n" +
  42. "MC -> resets memory value to 0 \n" +
  43. "MRC -> recalls the stored memory value \n" +
  44. "sine -> Calculate the sine of the current value \n" +
  45. "cosine -> Calculate the cosine of the current value \n" +
  46. "tangent -> Calculate the tangent of the current value \n" +
  47. "inverseSine -> 1/(sine of current value) \n" +
  48. "inverseCosine -> 1/(cosine of current value) \n" +
  49. "inverseTangent -> 1/(tangent of current value) \n" +
  50. "switchUnitsMode -> sets trig units to Degrees or Radians \n" + " \n" +
  51. "Bonus Features: \n" +
  52. "factorial -> calculates the factorial of the current value \n" +
  53. "log -> calculates the log of the current value \n" +
  54. "inverseLog -> calculates 10^(current value) \n" +
  55. "LN -> calculates the natural logarithm of the current value \n" +
  56. "inverseLN -> calculates e^(current value) \n" + " \n" +
  57. "Custom Features: \n" +
  58. "addFive -> sets current value to result of five plus the current value \n" +
  59. "help -> displays this help file \n" +
  60. "exit -> closes the calculator \n";
  61. }
  62. }