1234567891011121314151617181920212223242526272829303132333435 |
-
- /**
- * Write a description of class FizzBuzz here.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class FizzBuzz
- {
- Integer input;
- public FizzBuzz(){
-
- }
-
- public FizzBuzz(Integer input){
- this.input = input;
- }
-
- public String fizz()
- {
- if(input%3==0) return "Fizz";
- else return null;
- }
-
- public String buzz(){
- if(input%5==0) return "Buzz";
- else return null;
- }
-
- public String fizzBuzz(){
- if(input%3 ==0 && input%5==0) return "FizzBuzz";
- else return null;
- }
- }
|