Answer:
The solution is written using Python as it has a simple syntax.
- def getHighScores(gameScores, minScore):
- meetsThreshold = []
- for score in gameScores:
- if(score > minScore):
- meetsThreshold.append(score)
- return meetsThreshold
- gameScores = [2, 5, 7, 6, 1, 9, 1]
- minScore = 5
- highScores = getHighScores(gameScores, minScore)
- 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().
The car owner acquired his car because the car dealer offers him a financing credit services. It is part of the contract that the car owner should pay in monthly basis. It is a fact and part of the contract also that once the car owner failed to pay 2 months of his contribution, the car dealer will get his car back.
Answer:
Search for something that fits her needs
Explanation:
There are several approaches to problem solving, the approach that will be employed depends on our definition of the problem. Not all processes can be modeled by mathematical equations, some processes are simply theoretical and can be explained by simple logic.
If Allison does not find the needed equations among the available default equations, she can come up with an equation that addresses the process at hand. If she cannot come up with any, she can use other approaches that fit her needs to explain the required concept to the team.
Here you go,
Import java.util.scanner
public class SumOfMax {
public static double findMax(double num1, double num2) {
double maxVal = 0.0;
// Note: if-else statements need not be understood to
// complete this activity
if (num1 > num2) { // if num1 is greater than num2,
maxVal = num1; // then num1 is the maxVal.
}
else { // Otherwise,
maxVal = num2; // num2 is the maxVal.
}
return maxVal;
}
public static void main(String[] args) {
double numA = 5.0;
double numB = 10.0;
double numY = 3.0;
double numZ = 7.0;
double maxSum = 0.0;
/* Your solution goes here */
maxSum = findMax(numA, numB); // first call of findMax
maxSum = maxSum + findMax(numY, numZ); // second call
System.out.print("maxSum is: " + maxSum);
return;
}
}
/*
Output:
maxSum is: 17.0
*/