Write a statement that assigns numCoins with numNickels + numDimes.
Check the final answer first, then review the worked steps.
Answer
\(numCoins = numNickels + numDimes;\)
Work
numCoins = numNickels + numDimes;
Step-by-step solution
- Identify the variables: You have $numNickels$ and $numDimes$ defined and assigned values.
- Perform the assignment: You need to set $numCoins$ equal to the sum of the other two variables using the assignment operator '='.
- Write the code: Add the line $numCoins = numNickels + numDimes;$ inside the main method before the print statements.