CS 161 Lab D - Guessing Game

Due Thurs Feb 14 at 11:59pm

Overview

In this lab, you will create a simple game to play! The game is a "number guessing game"---the computer will pick a random number between 1 and 50, and then the player will try to guess it. The player will have 8 guesses. The player will enter the number they guess through the keyboard, and the program will let the player know how close their guess is (if they are "hot" or "cold"). When finished, your program's output might look something like:

Welcome to Guessing Game. I have selected a number between 0 and 50. You have 8 guesses.

Number of guesses remaining 8
Guess a number: 25
Your guess is cold
Number of guesses remaining 7
Guess a number: 20
Your guess is very cold
Number of guesses remaining 6
Guess a number: 30
Your guess is warm
Number of guesses remaining 5
Guess a number: 35
Your guess is extremely warm
Number of guesses remaining 4
Guess a number: 37

Congratulations, you figured it out!

Note that I typed in the 25, 30, 35, and 37.

If you run the program again (and are less lucky/clever), the output might look like:

Welcome to Guessing Game. I have selected a number between 0 and 50. You have 8 guesses.

Number of guesses remaining 8
Guess a number: 25
Your guess is icy freezing miserable cold
Number of guesses remaining 7
Guess a number: 15
Your guess is icy freezing miserable cold
Number of guesses remaining 6
Guess a number: 30
Your guess is very cold
Number of guesses remaining 5
Guess a number: 35
Your guess is cold
Number of guesses remaining 4
Guess a number: 40
Your guess is warm
Number of guesses remaining 3
Guess a number: 45
Your guess is extremely warm
Number of guesses remaining 2
Guess a number: 50
Your guess is very warm
Number of guesses remaining 1
Guess a number: 48
Your guess is scaldingly hot!

Sorry, you couldn't guess my number!

This lab will be completed in pairs. Be sure to review the pair programming guidelines. You also must work with a different partner than last time!

Objectives

Necessary Files

There are no necessary files for this class, but you might want to have the textbook handy!

Details

To create this program, you will need two Java classes, one to represent the SecretNumber and the other to be the main class that runs the GuessingGame.

Submitting

Upload the your SecretNumber.java and GuessingGame.java classes to the LabD folder on the submission folder on hedwig. Make sure you upload your work to the correct folder! The lab is due at midnight on the day of the lab.

Extensions

Grading

This assignment will be graded on approximately the following criteria: