Memory.java 870B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /**
  2. * Write a description of class Memory here.
  3. *
  4. * @author (your name)
  5. * @version (a version number or a date)
  6. */
  7. public class Memory
  8. {
  9. // instance variables - replace the example below with your own
  10. /**
  11. * Constructor for objects of class Memory
  12. */
  13. public Memory()
  14. {
  15. }
  16. public static double memory[] = new double[1];
  17. public static void addMemory(double num){
  18. memory[0] = num;
  19. System.out.println("Added "+ num + " to memory.");
  20. }
  21. public static double resetMemory(){
  22. memory[0] = 0;
  23. Console.currentNumber = 0;
  24. return Console.currentNumber;
  25. }
  26. public static double recallMemory(){
  27. //simpleOp.currentNumber = memory[0];
  28. //System.out.println(memory[0]);
  29. Console.currentNumber = memory[0];
  30. return Console.currentNumber;
  31. }
  32. }