
Guessing Game
In the course DTS, we had a guessing game project. This project was to generate a random number and then the user tried to guess the number. The program tells the user if their guess is too high or too low. When the user gets the answer correct, they are prompted to play again. This project was done in three parts, each part enhancing the program even more. The whole project took about three class days and no extra work outside of class was needed. It was an individual project with no research required. This project was meant to target our skills using a random number generator, do while loops and checking user input. Being able to use a random number generator was integral to this project. A random number needed to be generated each time the user wanted to play the game. Without this random number, the user wouldn’t have anything to guess or they would be trying to guess the same number each time. We needed to be able to make do while loops because most of the program was in a do while loop to check the user input at the end to see if they wanted to play again. Also, a do while loop in the program kept telling the user to guess higher or lower or if their number wasn’t within the range. We must be able to check the user input because we need to tell them if their guess is too high or too low or if it isn’t within the range. Another skill we needed to complete this project was our use of eclipse. We needed the knowledge of basic functions in eclipse, like print statements, variables, and if else statements.
In this project, I learned ways to modify my code. I used loops to avoid repeating blocks of code. I condensed my code whenever possible. I learned more about using random number generators and how to modify the range of numbers it generates. I also learned to control when a new random number was generated. One of the difficulties I faced was getting the program to run again. I overcame this difficulty by putting everything in a do while loop, where the condition was checking to see if they still wanted to play. If the user chose yes, the loop ran again. If the user chose no, the loop was exited. Another difficulty I faced was checking to see if the user’s input was within the range. I solve this by making an if statement to check if the number wasn’t within the range. If the user input wasn’t, the if statement would execute, which was a print statement telling the user their number was not within the range. Overall, this project enhanced my skills in java eclipse.

