# Penn Foster 402594 – Guaranteed 100% score

Lab Price = \$10
Please feel free to send us your queries at:
Payment Methods

Problem Statement
Project #402594
For your first project, you’ll create a simple number guessing
game. The game will use a for statement to ask for three
guesses and an if statement to determine if the answer is
right.
Instructions
1. In NetBeans, create a new Java Application project
named NumberGuess. Review Activity 2 for details.
2. In the main() method, add the code to generate a
random number:
int randNum = 0, guessNum = 0;
//Generates a random number from 1 to 10
randNum = new java.util.Random().nextInt(10) + 1;
System.out.println(“I am thinking of a number from
1 to 10”);
3. Using a for loop, ask for three guesses. See pages 23–24
in the textbook for more details. You can use the following
code to ask for a guess:
System.out.print(“Guess? “);
//Wraps the default input in a simple parser
called Scanner
java.util.Scanner scan = new
java.util.Scanner(System.in);
guessNum = scan.nextInt(); //Reads the next
command-line int
System.out.println(“You guessed “ + guessNum);
4. Using an if statement in the for block, determine
whether randNum and guessNum are equal. See pages
21–23 for in the textbook for more details. You can use the
following code if randNum and guessNum are equal:
System.out.println(“You guessed it!”);
break;
5. When you’re finished, the contents of the main() method
should resemble the following:
int randNum = 0, guessNum = 0;
//Generates a random number from 1 to 10
randNum = new java.util.Random().nextInt(10) + 1;
System.out.println(“I am thinking of random number
from 1 to 10”);
for (/* Figure this part out yourself */) {
System.out.print(“Guess? “);
java.util.Scanner scan = new
java.util.Scanner(System.in);
guessNum = scan.nextInt();
System.out.println(“You guessed “ +
guessNum);
if (/* Figure this part out yourself */) {
System.out.println(“You guessed it!”);
break;
6. Compile and run the project to ensure it works as
expected. To type input, make sure you click in the
Output panel; otherwise, you’ll modify code.
To submit your project, you must provide the following
two files:
■ NumberGuess.java
■ NumberGuess.class

Relevant Material
Screenshots
Instructions
* If you want to purchase multiple products then click on “Buy Now” button which will give you ADD TO CART option.Please note that the payment is done through PayPal.
* You can also use 2CO option if you want to purchase through Credit Cards/Paypal but make sure you put the correct billing information otherwise you wont be able to receive any download link.
* Your paypal has to be pre-loaded in order to complete the purchase or otherwise please discuss it with us at [email protected].
* As soon as the payment is received, download link of the solution will automatically be sent to the address used in selected payment method.
* All the contents are compressed in one zip folder.
* In case if you get stuck at any point during the payment process, please immediately contact us at [email protected] and we will fix it with you.
* We try our best to reach back to you on immediate basis. However, please wait for atleast 8 hours for a response from our side. Afterall, we are humans.
* Comments/Feedbacks are truely welcomed and there might be some incentives for you for the next lab/quiz/assignment.
* In case of any query, please donot hesitate to contact us at [email protected].
* MOST IMPORTANT Please use the tutorials as a guide and they need NOT to be used for any submission. Just take help from the material.
******************************************** Good Luck ***************************************************
Payment Details

Lab Price = \$10
Please feel free to send us your queries at:
Payment Methods