Operations.java 671B

12345678910111213141516171819202122232425262728293031323334
  1. import java.util.*;
  2. public class Operations
  3. {
  4. // instance variables - replace the example below with your own
  5. private int x;
  6. /**
  7. * Constructor for objects of class Operations
  8. */
  9. public Operations()
  10. {
  11. // initialise instance variables
  12. x = 0;
  13. }
  14. /**
  15. * An example of a method - replace this comment with your own
  16. *
  17. * @param y a sample parameter for a method
  18. * @return the sum of x and y
  19. */
  20. public int factorial(int number)
  21. {
  22. int fact = 1;
  23. for(int i = 1; i <= number; i++) {
  24. fact *= i;
  25. }
  26. return fact;
  27. }
  28. public int
  29. }