Memory.java 622B

12345678910111213141516171819202122232425262728293031323334353637
  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. private static double mem;
  10. public Memory()
  11. {
  12. // initialise instance variables
  13. mem = 0;
  14. }
  15. public static double memRead()
  16. {
  17. return mem;
  18. }
  19. public static double memUpdate(double n1)
  20. {
  21. return mem = n1;
  22. }
  23. public static double memClear()
  24. {
  25. return mem = 0;
  26. }
  27. public static void printAns(String printAnswer){
  28. System.out.println(printAnswer);
  29. }
  30. }