answer.
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
castortr0y [4]
1 year ago
15

Row array gameScores contains all player scores. Construct a row array highScores than contains all player scores greater than m

inScore. Hint: meetsThreshold is a logic array that indicates which elements in gameScores are greater than minScore.
Ex: If gameScores is [2, 5, 7, 6, 1, 9, 1] and minScore is 5, then highScores should be [7, 6, 9].

function highScores = GetHighScores(gameScores, minScore)
% gameScores: Array contains all player scores
% minScore: Scores greater than minScore are added to highScores

meetsThreshold = (gameScores > minScore); % Logic array indicates which
% elements are greater than minScore

% Construct a row array highScores containing all player scores greater than minScore
highScores=0;

end;
Computers and Technology
1 answer:
Sever21 [200]1 year ago
8 0

Answer:

The solution is written using Python as it has a simple syntax.

  1. def getHighScores(gameScores, minScore):
  2.    meetsThreshold = []
  3.    for score in gameScores:
  4.        if(score > minScore):
  5.            meetsThreshold.append(score)
  6.    return meetsThreshold
  7. gameScores = [2, 5, 7, 6, 1, 9, 1]
  8. minScore = 5
  9. highScores = getHighScores(gameScores, minScore)
  10. print(highScores)

Explanation:

Line 1-8

  • Create a function and name it as <em>getHighScores</em> which accepts two values, <em>gameScores</em> and <em>minScore</em>. (Line 1)
  • Create an empty list/array and assign it to variable <em>meetsThreshold</em>. (Line 2)
  • Create a for loop to iterate through each of the score in the <em>gameScores</em> (Line 4)
  • Set a condition if the current score is bigger than the <em>minScore</em>, add the score into the <em>meetsThreshold</em> list (Line 5-6)
  • Return <em>meetsThreshold</em> list as the output

Line 11-12

  • create a random list of <em>gameScores</em> (Line 11)
  • Set the minimum score to 5 (Line 12)

Line 13-14

  • Call the function <em>getHighScores()</em> and pass the<em> gameScores</em> and <em>minScore </em>as the arguments. The codes within the function <em>getHighScores()</em>  will run and return the <em>meetsThreshold </em>list and assign it to <em>highScores.</em> (Line 13)
  • Display <em>highScores</em> using built-in function print().
You might be interested in
There are two cons to an OLTP database. Which of the following are a solution of these cons?​
Delicious77 [7]

Answer:

The answer is below

Explanation:

An OLTP (Online transaction processing) database is a database that allows for quick transaction processing. It involves inserting, deleting, updating data in the database.

OLTP has many drawbacks like if the system fails, all transactions are going to have problems. Also, since multiple users are allowed to access the data, it makes it prone to hackers.

The solution to the problems associated to the OLTP database is the OLAP (online analytical processing) database.

The OLAP systems allow users to analyze database information from multiple database systems at one time thereby allowing analysis for business decisions.

6 0
2 years ago
If there are three classes, Shape, Circle and Square, what is the most likely relationship among them?
xz_007 [3.2K]

Answer: B) Shape is a base class, and circle and square are derived classes of Shape.

Explanation:

Shape is a base class because circle and squares are the shapes so these are the derived class of the shape, which is inherited by the shape like circle and square. As, the base class (shape) is the class which are derived from the other classes like circle and square and it facilitates other class which can simplified the code re-usability that is inherited from the base class. Base class is also known as parent class and the super class.  

8 0
2 years ago
In this image, which feature did we most likely use to quickly change the background, fonts, and layout?
MAVERICK [17]

Answer: themes

Explanation:

Took the test

3 0
1 year ago
What protocol communicates data between routers representing the edges of autonomous systems?Distance-vectorLink stateInterior g
Nata [24]

Explanation:

Exterior gateway protocol are the routing protocols that are used on the internet for exchanging routing information among the autonomous system. These autonomous systems can be gateway protocol, vector routing protocol.

8 0
1 year ago
In a particular jurisdiction, taxi fares consist of a base fare of $4.00, plus $0.25 for every 140 meters traveled. Write a func
devlian [24]

Answer:

// here is code in java.

import java.util.*;

// class definition

class Main

{

// method that return total fare

   public static double fare(double dis)

   {

   // calculate the total fare

       double tot_fare=(4+((dis*1000)/140)*0.25);

       return the fare

       return tot_fare;

   

   }

   //driver method

public static void main (String[] args) throws java.lang.Exception

{

   try{

    // scanner object to read input string

       Scanner s=new Scanner(System.in);

        // variable

       double dis;

       System.out.print("please enter the distance in KM: ");

       //read the number

       dis=s.nextDouble();

       

       // call the function with "dis" parameter

     double ride_fare=fare(dis);

     // print the total fare

     System.out.println("total fare is: "+ride_fare);

   }catch(Exception ex){

       return;}

}

}

Explanation:

Read the distance from user with the help of scanner class.Call the function with parameter "dis".Here it will calculate the total fare as (4+((dis*1000)/140)*0.25). Here base fare is $4 and $0.25 for every 140 meter.Then function will return the total fare.

Output:

please enter the distance in KM: 7                                                                                                                            

total fare is: 16.5  

7 0
1 year ago
Other questions:
  • Computer design software requires __________________ to be used properly and successfully by architects.
    9·2 answers
  • Which method allows a computer to react accordingly when it requests data from a server and the server takes too long to respond
    5·1 answer
  • You are the IT security administrator for a small corporate network. Samuel Garcia (sgarcia) has been away on vacation and has f
    9·1 answer
  • In this problem, we want to compare the computational performance of symmetric and asymmetric algorithms. Assume a fast public-k
    11·1 answer
  • .Ten pounds of candy were prepared for the school party.
    10·1 answer
  • The terminal window wants to evaluate your current bash knowledge by using the ~/workspace/nested-directories folder:
    15·1 answer
  • Write an expression to print each price in stock prices.
    15·1 answer
  • Cloud storage refers to the storage of data on ______.a. your mobile device.b. your desktop computer.c. an external drive.d. a s
    7·1 answer
  • Put the steps in order to produce the output shown below. Assume the indenting will be correct in the program.
    6·1 answer
  • In the file BankAccount.java, build a class called BankAccount that manages checking and savings accounts. The class has three p
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!