The correct answer is
A. the incorporation of technology into objects we use regularly
#Platogang
I believe its <span>c-set up a study space, preview your materials, create a routine</span>
Answer:
Here is the Python program which has a function sum_scores:
def sum_scores(score1, score2, score3, score4):
sum = score1 + score2 + score3 + score4
print(sum)
sum_scores(14,7,3,0)
Explanation:
- Method sum_scores takes four arguments, score1, score2, score3, score4.
- The sum variable adds these four scores and stores the value of their addition.
- Lastly print statement is used to print the value stored in sum variable which is the value obtained by adding the four scores.
- Last statement calls the sum_scores method and passes four values to it which are 14,7,3,0
- The output of the above program is:
- 24
- If you want to use return statement instead of print statement you can replace print(sum) with return sum. But in order to display the sum of the scores you can replace sum_scores(14,7,3,0) with print(sum_scores(14,7,3,0))
- The program along with the output is attached as a screenshot.
Answer:
See explaination
Explanation:
StackExample.java
public class StackExample<T> {
private final static int DEFAULT_CAPACITY = 100;
private int top;
private T[] stack = (T[])(new Object[DEFAULT_CAPACITY]);
/**
* Returns a reference to the element at the top of this stack.
* The element is not removed from the stack.
* atreturn element on top of stack
* atthrows EmptyCollectionException if stack is empty
*/
public T peek() throws EmptyCollectionException
{
if (isEmpty())
throw new EmptyCollectionException("stack");
return stack[top-1];
}
/**
* Returns true if this stack is empty and false otherwise.
* atreturn true if this stack is empty
*/
public boolean isEmpty()
{
return top < 0;
}
}
//please replace "at" with the at symbol
Note:
peek() method will always pick the first element from stack. While calling peek() method when stack is empty then it will throw stack underflow error. Since peek() method will always look for first element ffrom stack there is no chance for overflow of stack. So overflow error checking is not required. In above program we handled underflow error in peek() method by checking whether stack is an empty or not.