Question: In Java only please 3.31 Lab 5b: FizzBuzz Start by read in a number from the user that is in the range 1-200. If the

In Java only please

3.31 Lab 5b: FizzBuzz

Start by read in a number from the user that is in the range 1-200. If the user inputs a number out of that range, print out: Invalid number, and end the program.

Next,

  • If a number is divisible by 3, print Fizz instead
  • If a number is divisible by 5, print Buzz instead
  • If a number is divisible by both 3 and 5, print out FizzBuzz
  • If a number is none of the above, print the number itself.

Hint: What's the remainder if a number n is divisible by number m? That is, what would be the result of n % m?

LAB

ACTIVITY

3.31.1: Lab 5b: FizzBuzz

import java.util.Scanner;

public class FizzBuzz { public static void main(String[] args) { //TODO: read in input from the user, making sure to check it's within range //TODO: the loop to print 0-userInput } }

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!