605.201 Introduction to Programming Using Java Module 3 Assignment Solved

25.00 $

Category:

Description

  1. Write a program that prompts the user to enter the maximum number of plus signs (+) to display on a line of output, as well as a choice of two different output patterns. The program shall then display the plus signs according to one of the patterns below. For example, if the user specifies 10 as the maximum number of plus signs, the output should look like one of the following:
Choice = 1   Choice = 2
++++++++++

+++++++++

++++++++

+++++++

++++++

+++++

++++

+++

++

+

+

++

+++

++++

+++++

++++++

+++++++

++++++++

+++++++++

++++++++++

 
  1. Write a program that asks a user to guess a secret number between 1 and N, where N is a positive number that the user is prompted for. The program should also prompt the user for the maximum number of guesses they would like to make. Each time the player makes a guess, the program shall respond with “correct”, “too low”, or “too high”. The program should keep track of the number of guesses the user made to discover the secret number. The program should continue execution until the user has discovered the secret number or has used the maximum number of guesses. The program shall also allow the user to play the game again until the user declines. The program should generate the magic number randomly, using the built-in Java method Math.random(). To generate a random number between 1 and N, the following formula may be used: randomNumber = (int) ( N * Math.random() ) + 1

Submit the source code for each program in a zip file named as follows: Assignment3, followed by an underscore (_), followed by your first name initial, followed by your last name and section. For example, if your name is Jane Smith of section 81, your zip file would be Assignment3_jsmith81.zip. Please be sure to comment your source code.