CMPSCI111L
Project2
Skip To Content
Dashboard
  • Login
  • Dashboard
  • Calendar
  • Inbox
  • History
  • Help
Close
  • My Dashboard
  • CMPSCI111L
  • Assignments
  • Project2
2017FA
  • Home
  • Assignments
  • Syllabus
  • Quizzes
  • Collaborations
  • Library
  • The Learning Center
  • McGraw Hill Campus
  • Google Drive
  • Campus Resource Guide
  • EvaluationKIT Course
  • Online Tutoring
  • Services for Students
  • Employment Center
  • Office 365
  • Canyons Connects
  • Purchase Course Materials
  • Top Hat
  • Zoom
  • Lucid (Whiteboard)
  • Insights-Beta
  • Credentials
  • Insights

Project2

  • Due Sep 29, 2017 by 11am
  • Points 30
  • Submitting on paper
  • Available Sep 22, 2017 at 12:30pm - Sep 29, 2017 at 11am
This assignment was locked Sep 29, 2017 at 11am.

Computer Science 111 Intro to Algorithms and Programming: Java

Programming Project #2 – (30 points)

GuessingGame: 20 points
This is the old "I'm thinking of a number between...". When you run the program, the
computer randomly generates a number. Then, the user is to guess the number. Upon
guessing wrong, the program gives him/her a hint as to whether the guess is too high
or too low. Once the number has been guessed, the game is over.
Create a command line Java program to input, keep track of, and check user's attempts
to guess a randomly generated number. The input portion of the program will be a
continuous loop, only breaking out of it when the user either guesses the correct
number, or by entering -1 to signify giving up. After each guess, the user will be
informed of his guess being too high, too low, or exactly correct. Upon exiting the
loop, the user is given feedback of their guesses (amount guessed too low, amount
guessed too high, total number of guesses).
You'll need to generate a random number to be guessed by the user.
After the user is enters a guess, output a message. For example, "Your guess is larger
than the random value. Next guess: ". Or, "You've guessed correct!" if the number
guessed matches the random number the program generated.
Example of how this program's output should look after it runs:
run:
Guess the number I'm thinking of, from 1-100: 16
Your guess is larger than the random value. Next guess:
8
Your guess is larger than the random value. Next guess:
4
Your guess is smaller than the random value. Next guess:
6
You've guessed correct!
Total number of guesses: 4
Smaller Guesses: 1
Larger Guesses: 2

 

Break large problems into smaller pieces!
Sometimes it is useful for beginners to complete a smaller, simpler program before
tackling the full project. Start with an easy program that only completes part of the
project. Name your project 'project2' and your main class 'GuessingGame'. Always
use class, variable and project names that clearly describe what you are creating.
Please Design First
Dividing a larger problem into smaller sub-problems is an important technique in
computer programming.
It is a good practice to design your software before you write the code. Here are some
design tasks you should complete before you start:
 Write out a list of variables you think you will need (e.g. int totalGuesses; // count of
many guesses altogether scores)
 Flow chart (or Pseudo code) the selection statement(s) to decide if the guess was too
high, too low, or the equivalent number
 Flow chart (or Pseudo code) the loop, include the check for -1 input and update of
variables
In other words, have some idea about HOW you are going to solve the problem,
BEFORE you try to solve the problem. I would like to see a flowchart or a written
pseudocode when I grade your project.

Program2
MilesToKm: 10 points
Write a program that displays the following table. Use any loop (note that 1 mile is
1.609 km)
Miles Kilometers
1        1.609
2        3.218
...
...
9        14.481
10      16.090

1506708000 09/29/2017 11:00am
Please include a description
Additional Comments:
Rating max score to > pts
Please include a rating title

Rubric

Find Rubric
Please include a title
Find a Rubric
Title
You've already rated students with this rubric. Any major changes could affect their assessment results.
 
 
 
 
 
 
 
     
Can't change a rubric once you've started using it.  
Title
Criteria Ratings Pts
This criterion is linked to a Learning Outcome Description of criterion
threshold: 5 pts
Edit criterion description Delete criterion row
5 to >0 pts Full Marks blank
0 to >0 pts No Marks blank_2
This area will be used by the assessor to leave comments related to this criterion.
pts
  / 5 pts
--
Additional Comments
This criterion is linked to a Learning Outcome Description of criterion
threshold: 5 pts
Edit criterion description Delete criterion row
5 to >0 pts Full Marks blank
0 to >0 pts No Marks blank_2
This area will be used by the assessor to leave comments related to this criterion.
pts
  / 5 pts
--
Additional Comments
Total Points: 5 out of 5