600.108 Intro Programming Lab Week 1 Students must pair up. Choose starting navigator & driver roles. Only the driver can write/type, the navigator's role is to oversee and make suggestions and corrections. We will change roles throughout each lab session, and alternate starting roles each week. We change partners each month. PROBLEM STATEMENT: HI-LO GAME Write a program to play the hi-lo game. The user is expected to guess a number. After each guess, the program outputs whether the guess is too high, too low, or correct. The user only has 6 tries to guess correctly. A game is over when the user guesses correctly, or runs out of guesses. Once a game is over, the user can quit or play again. When the user quits, the program should output the percentage of how many times s/he won. ANALYSIS PHASE: [30 min] Using Word (or any text editor), create several sample runs to show the user interface of the program and possible input/output scenarios, similar to the examples we did in class. In other words, what you do expect to see on the screen when the program runs? What are possible inputs and corresponding output messages? Play the game a few times, making up examples to show sucesses and failures. Ask your lab leader if the problem needs clarification. Make sure your lab leader approves this stage before starting the next phase. [Switch roles] DESIGN PHASE: [30 min] Create a text file with a pseudocode solution. Ask your lab leader for help if necessary. Remember to make it sufficiently detailed and unambiguous. But DO NOT write actual program code. Show your pseudocode to your lab leader for approval. Rework as necessary. [10 min] For this week only, you will then receive cut-up pseudocode that needs to be arranged into the proper order. The real Java program code will be on the reverse side. Once you have arranged the pieces of pseudocode, show them to your lab leader for verification of correctness. [Switch roles] CODING PHASE: [30 min] The (new) driver should open jGRASP. For this week, type in the Java code that was given to you with the pseudocode (viewable at http://www.cs.jhu.edu/~joanne/cs108/hi_loBAD.java). Save and compile your program periodically as you type. There will be several compiler errors once you've finished typing the program as given. Do your best to fix them yourselves, then ask a lab leader for help. Let the lab leader know when you have it compiling successfully. [Switch roles] TESTING PHASE: [30 min] Make up a large test suite of sample runs. There are a few more mistakes in the program that won't show up until you test it thoroughly. Write down the sample inputs that cause problems and try to fix them. Show your lab leader what you've done and get help as needed. ************************************************** MAKE SURE YOU DELETE YOUR FILES OFF THE LAB COMPUTER WHEN DONE!!! FAILURE TO DO SO IS AN ETHICS VIOLATION! (Save on a flash drive or in email first.) **************************************************