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

(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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!