fizzbuzzy Dat

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Can someone help me set up this code. I am very confused. All information is in the photos. There is also a template but I don’t know how to use it (if you would like to see the template contact me it won’t let me add more than 2 photos). Please please help! The instructions are on the photos as well.
You need to make a single function of this signature:
void fizzbuzzy(int max, int step, int divisorOne, int divisorTwo)
int max: Determines what number the calculation should go up to
int step: Step size between numbers, how many to skip in between
int divisorOne: The number to use for the "Fizz" divisor
int divisorTwo: The number to use for the "Buzz" divisor
FizzBuzz is a classic programming interview problem.
FizzBuzz will have a max number you go up to, a first divisor, and a second divisor.
Travel from 1 to the max and print "Fizz" if the number is divisble by the first divisor,
"Buzz" if it's divisible by the second divisor, and "FizzBuzz" if divisible by both.
If you're given the scenario to count to max of 10 with divisors of 2 and 5 the output should be:
1
Fizz
3
Fizz
Buzz
Fizz
7
Fizz
FizzBuzz
Transcribed Image Text:You need to make a single function of this signature: void fizzbuzzy(int max, int step, int divisorOne, int divisorTwo) int max: Determines what number the calculation should go up to int step: Step size between numbers, how many to skip in between int divisorOne: The number to use for the "Fizz" divisor int divisorTwo: The number to use for the "Buzz" divisor FizzBuzz is a classic programming interview problem. FizzBuzz will have a max number you go up to, a first divisor, and a second divisor. Travel from 1 to the max and print "Fizz" if the number is divisble by the first divisor, "Buzz" if it's divisible by the second divisor, and "FizzBuzz" if divisible by both. If you're given the scenario to count to max of 10 with divisors of 2 and 5 the output should be: 1 Fizz 3 Fizz Buzz Fizz 7 Fizz FizzBuzz
This modification of the problem will take a "step" that changes how much we increment between
numbers.
For example, for the function fizzbuzzy(10, 3, 2, 4) the output should be:
1
FizzBuzz [was 4]
7
Fizz [was 10]
Constraints:
• The max must always be a positive number.
• The step size must always be a positive number.
.
The divisors must be at least 2 or greater.
• The divisors cannot be the same number.
• If a number divisible by 42 occurs, print "Answered" instead of what the input would have been
otherwise, then exit the function.
You should be error checking to see if runtime or logic errors occur in the numbers inputted.
If any error is thrown because of the input given, print "Bad Input" and exit the function.
Transcribed Image Text:This modification of the problem will take a "step" that changes how much we increment between numbers. For example, for the function fizzbuzzy(10, 3, 2, 4) the output should be: 1 FizzBuzz [was 4] 7 Fizz [was 10] Constraints: • The max must always be a positive number. • The step size must always be a positive number. . The divisors must be at least 2 or greater. • The divisors cannot be the same number. • If a number divisible by 42 occurs, print "Answered" instead of what the input would have been otherwise, then exit the function. You should be error checking to see if runtime or logic errors occur in the numbers inputted. If any error is thrown because of the input given, print "Bad Input" and exit the function.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY