1234567891011121314151617181920212223242526272829303132333435
  1. /**
  2. * Write a description of class FizzBuzz here.
  3. *
  4. * @author (your name)
  5. * @version (a version number or a date)
  6. */
  7. public class FizzBuzz
  8. {
  9. Integer input;
  10. public FizzBuzz(){
  11. }
  12. public FizzBuzz(Integer input){
  13. this.input = input;
  14. }
  15. public String fizz()
  16. {
  17. if(input%3==0) return "Fizz";
  18. else return null;
  19. }
  20. public String buzz(){
  21. if(input%5==0) return "Buzz";
  22. else return null;
  23. }
  24. public String fizzBuzz(){
  25. if(input%3 ==0 && input%5==0) return "FizzBuzz";
  26. else return null;
  27. }
  28. }