subject

"Simon Says" is a memory game where "Simon" outputs a sequence of 10 characters (R, G, B, Y) and the user must repeat the sequence. Create a for loop that compares the two strings starting from index 0. For each match, add one point to userScore. Upon a mismatch, exit the loop using a break statement. Assume simonPattern and userPattern are always the same length. Ex: The following patterns yield a userScore of 4:

simonPattern: RRGBRYYBGY
userPattern: RRGBBRYBGY
public class SimonSays {
public static void main (String [] args) {
Scanner scnr = new Scanner(System. in);
String simonPattern;
String userPattern;
int userScore;
int i;

userScore = 0;

simonPattern = scnr. next();
userPattern = scnr. next();

/* Your solution goes here */

System. out. println("userScore: " + userScore);

return;
}
}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 22:20
Pp 4.1 design and implement a class called sphere that contains instance data that represents the sphere’s diameter. define the sphere constructor to accept and initialize the diameter and include getter and setter methods for the diameter. include methods that calculate and return the volume and surface area of the sphere (see pp 3.5 for the formulas). include a tostring method that returns a one-line description of the sphere. create a driver class called multisphere, whose main method instantiates and updates several sphere objects.
Answers: 1
question
Computers and Technology, 23.06.2019 16:00
Which analyst position analyzes information using mathematical models to business managers make decisions?
Answers: 1
question
Computers and Technology, 23.06.2019 21:30
Examine the list below. which factors positively affect lifetime income? check all that apply.
Answers: 1
question
Computers and Technology, 24.06.2019 01:10
Create a program that will take in a single x and y coordinate as the origin. after the input is provided, the output should be all of the coordinates (all 26 coordinates read from the “coordinates.json” file), in order of closest-to-farthest from the origin.
Answers: 1
You know the right answer?
"Simon Says" is a memory game where "Simon" outputs a sequence of 10 characters (R, G, B, Y) and the...
Questions
question
Mathematics, 25.02.2021 14:00
question
Mathematics, 25.02.2021 14:00
question
Mathematics, 25.02.2021 14:00
question
Social Studies, 25.02.2021 14:00
Questions on the website: 13722360