calculatorCoreFunctions.java 741B

123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. * Write a description of class calculatorCoreFunctions here.
  3. *
  4. * @author (your name)
  5. * @version (a version number or a date)
  6. */
  7. public class calculatorCoreFunctions
  8. {
  9. // instance variables - replace the example below with your own
  10. private int x;
  11. /**
  12. * Constructor for objects of class calculatorCoreFunctions
  13. */
  14. public calculatorCoreFunctions()
  15. {
  16. // initialise instance variables
  17. x = 5;
  18. //y= 0;
  19. }
  20. /**
  21. * An example of a method - replace this comment with your own
  22. *
  23. * @param y a sample parameter for a method
  24. * @return the sum of x and y
  25. */
  26. public int add(int y)
  27. {
  28. // put your code here
  29. return x + y;
  30. }
  31. }