Tags:
view all tags
---+ Review arrays: Mastermind part 1 ---++ Learning Objective(s) 1 Improving programming and working with arrays ---++ Overview of the program 1. The user inputs an array of colors (represented by integers) and the program generates an array of colors. 1. The system outputs how many of the colors in the two arrays are perfect matches (i.e. the same color in the same position). 1. The system then outputs the number of each of the colors in each of the arrays. 1. These are tools that will help create a master mind game program. ---++ Details 1 The keyboard should only be instantiated one time in the running of the program. 1 You must implement at least 4 different colors. 1 The first color should be white and the last color should be black. 1 Use constants for all colors, the number of "spots" in the game, the first color, and the last color. 1 Have a method that returns a string for a given color (int). 1 Have a method that displays the "menu". It should use the constants. It is best if it uses a loop (but that is not necessary) 1 Have a method that return a valid color. It should continue to get a value until the user inputs a valid color. 1 Have a method that returns an array of colors inputted by the user. It should be sent the number of spots 1 Have a method that returns an array of random colors. It should be sent the number of spots. 1 Have a method that returns the number of colors that are an exact match in the two arrays 1 Have a method the returns the number of times a value appears in the array. 1 The user inputs the colors as single letters as seen in the example dialogue. 1 Program should be called *MasterMind1* ---++Sample dialogue <pre> Color choices are: 0) white 1) red 2) blue 3) green 4) yellow What color do you want? <b>0</b> What color do you want? <b>5</b> What color do you want? <b>-1</b> Invalid choice. Try again. Color choices are: 0) white 1) red 2) blue 3) green 4) yellow <b>2</b> What color do you want? <b>7</b> Invalid choice. Try again. Color choices are: 0) white 1) red 2) blue 3) green 4) yellow <b>3</b> What color do you want? <b>3</b> There are 2 white in the random list There are 1 red in the random list There are 1 blue in the random list There are 0 green in the random list There are 1 yellow in the random list There are 0 black in the random list There are 1 white in the user list There are 0 red in the user list There are 1 blue in the user list There are 2 green in the user list There are 0 yellow in the user list There are 1 black in the user list There are 1 perfect matches between the two lists. </pre> ---++ Submission a. Create your SDR. * In *Lessons Learned*, insights about coding and arrays where you have improved your understanding * If you used any hints, be sure to indicate that in the *Outside Resources Used* section * For *Future Improvements* include a discussion about ideas how to not waste as much space. a. Convert your SDR into a pdf document a. Create an empty zip folder a. Place your java file and pdf document in it. a. Submit the zip folder on canvas ---++ Hints No hints this time. Just work on the methods (in order listed above) without moving until that method compiles, is tested, and works ---++ Optional improvements None this time.
Edit
|
Attach
|
Watch
|
P
rint version
|
H
istory
:
r2
<
r1
|
B
acklinks
|
V
iew topic
|
Raw edit
|
More topic actions...
Topic revision: r1 - 2024-04-08
-
CathyBareiss
Home
Site map
Assessment web
BethelAIResources2026 web
CenterForComputing web
ChatGPT web
Intro2AIatBethel web
Main web
Sandbox web
TWiki web
CenterForComputing Web
Create New Topic
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
P
P
View
Raw View
Print version
Find backlinks
History
More topic actions
Edit
Raw edit
Attach file or image
Edit topic preference settings
Set new parent
More topic actions
Account
Log In
Register User
Edit
Attach
Copyright © 2008-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback