Question: Need help with Java homework. Answer the below questions. You may use whatever IDEs / text editors you like, but you must submit your responses

Need help with Java homework.

Need help with Java homework. Answer the below questions. You may use

whatever IDEs / text editors you like, but you must submit your

responses on Vocareum. You will find a link to Vocareum in Moodle.

Answer the below questions. You may use whatever IDEs / text editors you like, but you must submit your responses on Vocareum. You will find a link to Vocareum in Moodle. Responses will be graded on correctness, code design, and code style. Cor- rectness refers to your code's ability to pass the automated test cases (when you click "Sub in Vocareum, you will receive a report stating how many correctness points you have earned). Note that your program's output must ex- actly match the specs given here for each problem to pass the test cases. Design refers to how well your code is written (i.e. is it clear, efficient, and elegant). Style refers to the readability of your code (commented, correct indentation, good variable names) (6) (10 points) Write a Java class called PersonalizedHelloworld that prompts a user for their name and then displays "Hello, name here!" The flow should look like the following: What is your name? John Tsai Hello, John Tsai! If the user does not enter anything but presses Enter anyways, you should re-prompt for the user's name. This flow should look like the following (note that there should be a space after any? or:) What is your name? Please enter your name: Please enter vour name: John Tsai Hello, John Tsai! (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 5 FIZZBUZZ 7 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 BUZZ FIZZ 5 FIZZBUZZ 7 FIZZ (8) (20 points) Write a Java class called GuessMyNumber that prompts the user for an integer , tells the user to think of a number between 0 and n 1, then makes guesses as to what the number is. After each guess, the program must ask the user if the number is lower, higher, or correct. You must implement the divide-and-conquer algorithm from class. In particu- lar, you should round up when the middle of your range is in between two integers. (For example, if your range is 0 to 31, you should guess 16 and not 15, but if your range is 0 to 30 you should certainly guess 15). The flow should look like the following: Enter n: 32 Welcome to Guess My Number! Please think of a number between 0 and 31 Is your number: 16? Please enter C for correct, H for too high, or L for too low Enter your response (H/L/C): H Is your number: 8? Please enter C for correct, H for too high, or L for too low Enter your response (H/L/C): L Is your number: 12? Please enter C for correct, H for too high, or L for too low Enter your response (H/L/C): C Thank you for playing Guess My Number! As part of your implementation, you should check that n is not 0 or negative. (You need not worry about the case where the user enters a non-integer. You should also check that the user is entering one of the letters H, L, or C each time your program makes a guess. This flow should look like the following: Enter n: -1 Enter a positive integer for n: 32 Welcome to Guess My Number! Please think of a number between 0 and 31 Is vour number: 16? Please enter C for correct, H for too high, or L for too low Enter your response (H/L/C): asdf Enter your response (H/L/C): H Is your number: 8? You can assume that the user will always give honest answers

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!