For all numbers from 1 to 100 (inclusive):
- if it is divisible by 3, output "Fizz"
- if it is divisible by 5, output "Buzz"
- if it is divisible by neither, output the number
Expected output after running the program: 1 2 Fizz 4 Buzz ...
- Use Java.
- Keep track of your work/changes in a Git repository. The commit history is important to show progress/evolution.
- Prior to the interview provide a link to the repository (in case of a public GitHub one for instance) or a ZIP archive containing a copy of your local repository.
Implement an application for above problem description.
Prove its correctness using unit testing (for all cases).
Update your implementation to receive as input a Map<Integer, String>
, where
the keys are the divisors and the values are the expected output. For the
initial problem this would be Map.of(3, "Fizz", 5, "Buzz)
.