| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
-
- /**
- * Write a description of class FizzBuzz here.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class FizzBuzz
- {
- // instance variables - replace the example below with your own
-
- /**
- * Constructor for objects of class FizzBuzz
- */
- public FizzBuzz()
- {
- // initialise instance variables
-
- }
-
- /**
- *
- */
- public String fizzbuzz(int y)
- {
- String result = "";
- if(y%3 == 0 && y%5 == 0){
- result = "FizzBuzz";
- }
- else if(y%3 == 0){
- result = "Fizz";
- }else if(y%5 == 0){
- result = "Buzz";
- }else {
- result = Integer.toString(y);
- }
-
- return result;
- }
- }
|