Ask Question
23 February, 18:07

Write a statement that assigns numCoins with numNickels + numDimes. Ex: 5 nickels and 6 dimes results in 11 coins. Note: These activities may test code with different test values. This activity will perform two tests: the first with nickels = 5 and dimes = 6, the second with nickels = 9 and dimes = 0. import java. util. Scanner; public class AssigningSum {public static void main (String [] args) {

int numCoins; int numNickels; int numDimes; numNickels = 5; numDimes = 6; / * Your solution goes here * / System. out. print ("There are "); System. out. print (numCoins); System. out. println (" coins"); }}

+1
Answers (1)
  1. 23 February, 19:34
    0
    The statement that assigns the sum of numNickels and numDimes to numCoins is as follows:-

    numCoins = numNickels + numDimes;

    System. out. print ("There are "); System. out. print (numCoins); System. out. println (" coins");

    numNickels = 9;

    numDimes = 0;

    numCoins = numNickels + numDimes;

    System. out. print ("There are "); System. out. print (numCoins); System. out. println (" coins");

    Explanation:

    The first statement in the solution adds the values of numNickels (6) and numDimes (11), the rrsult is then saved in numCoins variable

    The next line prints the value of numCoins (17) alongside some strings

    The next line assigns 9 to numNickels

    The next line assigns 0 to numDimes

    The next line adds the values of numNickels (9) and numDimes (0), the result is then saved in numCoins variable

    The next line prints the value of numCoins (9) alongside some strings
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write a statement that assigns numCoins with numNickels + numDimes. Ex: 5 nickels and 6 dimes results in 11 coins. Note: These activities ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers