Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello there , I need help w/ my assignment . Clear answers please . COMP 1900 - Fall 2018 Lab 4 Homework: Basic Loops (15

Hello there , I need help w/ my assignment . Clear answers please . image text in transcribed
COMP 1900 - Fall 2018 Lab 4 Homework: Basic Loops (15 pts) Number of People: Individual Due: By the beginning of next week's lab session Grader: Please refer to the COMP 1900 syllabus for your lab TA. Questions about grading? Contact him/her first Coding Style: Use camelCase for variable names, use consistent indentation in your code, and include a reasonable amount of comments throughout your code. The TAs may deduct points for poor coding style. Within the 1900 folder on your desktop, create a new folder named Lab4HW In this assignment you'll develop a simple guessing game that involves trying to pick an integer between 1 and 100, randomly chosen by the computer. To help keep things manageable, we'll add features incrementally. Be sure to thoroughly test your program at each step! (5 pts) Let's start with the basics! Within your Lab4HW folder, create a new file named GuessingGame.java. Write a program that makes the computer pick a random integer between 1-100 (inclusive), then uses a loop to repeatedly get user input until s/he enters the correct number. Refer to Section 2.18 of the zyBook for how to generate random integers. 1. (5 pts) Make your program indicate whether the player's guesses are too high or too low. Also make the program display an error message if the player tries to enter guesses below 1 or above 100. 2. (5 pts) Make your program track the number of guesses made by the player. Show this number once s/he gets it right. Invalid guesses (those below 1 or above 100) should NOT count towards this number 3. Below is an example of what your final program might look like when you run it (the underlined parts indicate what you type in as the program is running): I'n thinking of an integer betveen 1 and 100. Try to guess what it is! Enter your guess: 50 That's too low! Enter your queas: 101 You nust enter a nusber between 1-10o Enter your guess: 100 That's too high! Enter your guess: 75 That's too high! Enter your guess: 50 That's too high! Enter your guess: 55 That's too high! Enter your quess: 52 That's too high! Enter your guess: 51 You got it It took you 7 tries to get the right nunber

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 10g SQL

Authors: Joan Casteel, Lannes Morris Murphy

1st Edition

141883629X, 9781418836290

More Books

Students also viewed these Databases questions

Question

Which of these activities are working well/not so well?

Answered: 1 week ago

Question

What challenges do you face in your current role?

Answered: 1 week ago

Question

How well is the company IT system able to support this initiative?

Answered: 1 week ago