Question: (7) (20 points) Write a Java class called GeneralizedFizzBuzz that prompts a user for three integers n, p, and q, and then prints all integers

(7) (20 points) Write a Java class called GeneralizedFizzBuzz that prompts a user for three integers n, p, and q, and then prints all integers from 1 to n, each on its own line, with the following exceptions (a) If the number is a multiple of p but not q, print "FIZZ (b) If the number is a multiple of q but not p, print "BUZZ (c) If the number is a multiple of p and q, print "FIZZBUZZ The flow should look like the following: Enter n: 8 Enter p:2 Enter q: 3 FIZZ BUZZ FIZZ FIZZBUZZ FIZZ As part of your implementation, you should check that n, p, and q are not 0 or negative. (You need not worry about the case where the user enters a non-integer.) This flow should look like the following Enter n:-8 Enter a positive integer for n:0 Enter a positive integer for n:8 Enter p: 2 Enter q: -3 Enter a positive integer for q: 3 FIZZ BU2Z FIZZ FI2ZBUZZ FIZZ
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
