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
*/
Answer:
Stack
Explanation:
Stack is a linear data structure that follows a particular order in the way an operation is done or sequence a job is completed.
It uses either LIFO ( Last In, First Out) which is also known as first come first served sequence or FILO (First In, Last Out) sequence.
There are several real life examples of which we can use the example of replacing the snack items Sarah brought for the customer.
If Sarah used the LIFO method, it means she replaced the snack items first ontop of the already existing snack items that's why there is a mismatch.
Answer:
- <em>Their country can support </em><u><em> 128 </em></u><em>unique license plates</em>
Explanation:
Since there is space for<em> 7 digits </em>on each <em>license plate</em>, the first plate starts at <em>0000000 </em>(seven 0).
<em>Binary numbers</em> contain only the digits 0 and 1.
Thus, there are only two possibilities for each digit.
Using the multiplication counting principle, the number of total different binary numbers, with seven digits is 2 multiplied seven times:
- 2 × 2 × 2 × 2 × 2 × 2 × 2 = 2⁷ = 128 ← answer
Answer:
Enter a number: 7
Enter a number: 10
Traceback (most recent call last):
File "main.py", line 3, in <module>
print (numi + num2)
NameError: name 'numi' is not defined
Explanation:
The typo in the print statement causes a run-time error, where obviously num1+num2 was expected, and an output of 17.