1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
son4ous [18]
3 years ago
5

"Simon Says" is a memory game where "Simon" outputs a sequence of 10 characters (R, G, B, Y) and the user must repeat the sequen

ce. 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
Computers and Technology
2 answers:
weqwewe [10]3 years ago
5 0

int main() {

string simon_Pattern;

string user_Pattern;

int userScore;

int i;

user_Score = 0;

simon_Pattern = "RRGBRYYBGY";

user_Pattern = "RRGBBRYBGY";

for (i = 0; i <= simson_pattern.length; i++) {

if (simon_Pattern[i] == user_Pattern[i]) {

user_Score = user_Score + 1;

} else {

break;

}

}

cout << "userScore: " << user_Score << endl;

return 0;

}

Here it uses two string variable to store “simson’s pattern and user’s pattern”. Then a “for loop” is executed till the end of the string. Inside the for loop both the strings are compared character by character and when found the score is added. If not for loop is exited and finally the score is displayed.

Fofino [41]3 years ago
5 0

Answer:

The code is given below in Java

Explanation:

import java.util.Scanner;

public class SimonSays

{

  public static void main(String[] args)

  {

      String simonPattern = "";

      String userPattern = "";

      int userScore = 0;

      int i = 0;

      userScore = 0;

      simonPattern = "RRGBRYYBGY";

      userPattern = "RRGBBRYBGY";

      for (i = 0; i < simonPattern.length(); i++)

      {

          if (simonPattern.charAt(i) == userPattern.charAt(i))

          {

              userScore = userScore + 1;

          }

          else

          {

              break;

          }

      }

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

      return;

  }

}

You might be interested in
In a relational database, the three basic operations used to develop useful sets of data are:_________.
olga_2 [115]

In a relational database, the three basic operations used to develop useful sets of data are:

\sf\purple{a.\: Select, \:project,\: and\: join. }

\large\mathfrak{{\pmb{\underline{\orange{Mystique35 }}{\orange{❦}}}}}

6 0
3 years ago
You use worksheets to perform calculations. How do you perform these calculations?
Elena-2011 [213]
The main function you will use is.... Type SUM= in all caps into a cell and then you can control click cells to add them together. You can also add PEMDAS properties to do calculations withing it.
5 0
3 years ago
Read 2 more answers
Which of these is a requirement for developing game applications on devices running Apple’s iOS operating system?
andrey2020 [161]

Answer:

A. Xcode libraries

Explanation:

We have to find a requirement for developing game applications on devices running Apple’s iOS operating system. For that, I will evaluate each answer.

A. Xcode libraries

Xcode can be generally defined as a development kit or integrated development environment to facilitate the Apple software development. Apple use iOS operating system for its devices. To develop anything compatible with iOS, you generally have to code it using Xcode. Obviously, each development kit includes libraries for project to be built. Therefore, this option is correct.  

B. Android Development Kit

Just like Xcode, Android Development Kit is used to build the software for android. It is pretty much comprehensible from its name. So,  this option is false.  

C. ARM technology  and D. advanced microprocessors

These both options are related to hardware and available on both the devices. It is used for overall processing but these options are not that relevant to iOS operating system. Therefore, these options are false too.

So, Correct option is Xcode libraries.

5 0
3 years ago
Read 2 more answers
Identify any eight new programming languages and classify them based on their functionality.
shepuryov [24]

Answer:

Some of the new programming languages are R, Python, Haskell, Swift, C++, Java, Javascript and PHP.

However, you should know that in general sense there are three types of programming languages.

R is a pure object-oriented programming language being used for scientific purposes, and now it is being used extensively for machine learning as well.

Python is also a pure object-oriented programming language, and it is being used for mainly machine learning. However, you need to keep in mind that it supports the functional programming paradigm as well.

Haskell is a functional programming language and is the best in the functional paradigm as well. You can compare it with LISP, FORTRAN and PASCAL or COBOL, and you will find that Haskell is the best.

Swift is a pure object-oriented programming language, And by pure it means it never cheats anybody like if it says a variable is an int, it will be an int and not like C# here a string data type can be an integer data type. And this is not the correct thing. However, if you study in deep, you will find it is a necessary evil.

C++ and Java are imperative programming languages.

The Javascript and PHP are the scripting languages that support the object-oriented programming concepts but not fully, and they too fall under the imperative programming language list.

Explanation:

The answer is self explanatory.

4 0
3 years ago
Read 2 more answers
Convert the following four unsigned binary numbers to decimal and show your work:
Ber [7]

Answer:

23 ,21,10,63,13

Explanation:

We have to convert binary to decimal

10111 corresponding decimal number is

1\times 2^4+0\times 2^3+1\times 2^2+1\times 2^1+1\times 2^0=23

10101 corresponding decimal number is

1\times 2^4+0\times 2^3+1\times 2^2+0\times 2^1+1\times 2^0==21

01010 corresponding decimal number is

0\times 2^4+1\times 2^3+0\times 2^2+1\times 2^1+0\times 2^0=10

111111 corresponding decimal number is

1\times 2^5+1\times 2^4+1\times 2^3+1\times 2^2+1\times 2^1+1\times 2^0=63

001111 corresponding decimal number is

0\times 2^5+0\times 2^4+1\times 2^3+1\times 2^2+1\times 2^1+1\times 2^0=13

7 0
3 years ago
Other questions:
  • Encrypt the message ENCRYPTION using a tabular transposition cipher with encryption keyword ONE. If necessary, pad the message w
    7·1 answer
  • In fiberoptic cable, the signal source is__________waves
    7·1 answer
  • This toolbar can be used to change the way the text in your presentation looks. Drawing
    5·2 answers
  • Magnetic ram (mram) uses ____ rather than an electrical charge to store data.
    6·1 answer
  • How do you validate the type of text that a user enters?
    7·1 answer
  • True or false? Colons are required when entering the MAC address into the Reservation window?
    14·1 answer
  • Add Try/Catch error checking To make sure that the user enters valid values in your program. To catch negative values passed to
    9·1 answer
  • Select all of the reasons Windows 95 increased the popularity of Windows.
    12·1 answer
  • How many passes will it take to find 30 using a binary search?
    6·1 answer
  • Identify and explain 4 traditional (old ways) marketing approaches used by University uses in reaching
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!