answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
My name is Ann [436]
2 years ago
4

Write a statement that assigns numCoins with numNickels + numDimes. Ex: 5 nickels and 6 dimes results in 11 coins. Note: These a

ctivities 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");}}
Computers and Technology
1 answer:
Rufina [12.5K]2 years ago
4 0

Answer:

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

You might be interested in
For the (pseudo) assembly code below, replace X, Y, P, and Q with the smallest set of instructions to save/restore values on the
Dimas [21]

Answer:

Explanation:

Let us first consider the procedure procA; the caller in the example given.

  Some results: $s0,$s1,$s2, $t0,$t1 and $t2 are being stored by procA. Out of these registers, few registers are accessing by procA after a call to procB. But, procB might over-write these registers.

       Thus, procA need to save some registers into stack first before calling procB, .

      only $s1,$t0 and $t1 are being used after return from procB in the given example,

       Caller saves and restores only values in $t0-$t9, according to MIPS guidelines for caller-saved and callee-saved registers, .

       Thus, procA needs to save only $t0 and $t1.

    jal instruction overwrites the register $ra by writing the address, to which the control should jump back, after completing the instructions of procB, when procB is called,.

       Therefore, procA also need to save $ra into stack.

 ProcA is writing new values into $a0,$a2, procA must save $a0 and $a1 first before calling procB, .

     In the given example, after return from procB, only $a0 is being used. It is therefore enough to save $a0.

   Also, procA needs to save frame pointer, which points the start of the stack space for each procedure.

       Generally, as soon as the procedure begins, frame pointer is set to the current value of the stack pointer,.

Let us consider the procedure procB; the callee in the given example.

 The callee is responsible for saving values in $s0-$s7 and restoring them before returning to caller, this is according to MIPS guidelines for caller-saved and callee-saved registers,

   procB is expected to over-write the registers $s2 and $t0. Nonetheless, in the first two lines, procB might over-write the registers $s0 and $s1.

   Thus, procB is responsible for saving and restoring $s0,$s1 and $s2.

X:

We need to create space for 5 values on the stack since procA needs to save $a0,$ra,$t0,$t1 and $fp(frame pointer), . Each value(word) takes 4 bytes.

$sp = $sp – 20 # on the stack, create space for 5 values

sw $a0, 16($sp) # store the result in $a0 into the memory address

               # indicated by $sp+20

sw $ra, 12($sp) # save the second value on stack

sw $t0, 8($sp) # save the third value on stack

sw $t1, 4($sp) # save the fourth value on stack

sw $fp, 0($sp) #  To the stack pointer, save the frame pointer

$fp = $sp      #  To the stack pointer, set the frame pointer

Y:

lw $fp, 0($sp) #  from stack, start restoring values

lw $t1, 4($sp)

lw $t0, 8($sp)

lw $ra, 12($sp)

lw $a0, 16($sp)

$sp = $sp + 20 # decrease the size of the stack

P:

$sp = $sp – 12 #  for three values, create space on the stack

sw $s0, 0($sp) # save the value in $s0

sw $s1, 0($sp) # save the value in $s1

sw $s2, 0($sp) # save the value in $s2

Q:

lw $s0, 0($sp) #  from the stack, restore the value of $s0

lw $s1, 0($sp) #  from the stack, restore the value of $s1

lw $s2, 0($sp) #  from the stack, restore the value of $s2

$sp = $sp + 12 # decrease the stack size

8 0
2 years ago
Anna bought a box of blueberries for £7. She used 700 grams for a cheesecake and she has 450 grams left. How much did the bluebe
xxTIMURxx [149]

0.61 (rounded up)

Explanation:

You add both 700 and 450 which will give you 1150g

You then divide 1150 by 100 which gives you 11.5

Then divide 7 by 11.5 which will give you 0.61 as cost of every 100 grams

8 0
2 years ago
Exercise 3.6.9: 24 vs. "24"5 points
Anton [14]

This is all you need to do for this one add quotes around the number to make it a string. Then for the question I don't know if you need to answer it but I said that when there is only one string it creates and addition problem of 24 + 24 and then when there are two strings it puts them right next to each other making it look like the number 2424.

7 0
2 years ago
What happens as the key length increases in an encryption application?
pashok25 [27]
<span>The answer is : Increasing the key length of DES would  protect it against brute force attacks.  </span>Brute force is when the attacker tries every key knowing that one will eventually work.  <span>Key length increase proportionally increases the key space,  having a keyspace l</span>arge enough that it takes too much time and money to accomplish a brute force attack.
6 0
2 years ago
Which statement describes the word "iterative"?
Umnica [9.8K]

guess you better read the directions and just read the book yourself and find the answer.

0 0
2 years ago
Read 2 more answers
Other questions:
  • Wesley has to create a web banner to announce a “Back to School” sale by an online retailer. Which information should he determi
    15·2 answers
  • When performing actions between your computer and one that is infected with a virus, which of the following offers NO risk of yo
    11·2 answers
  • When an author produce an index for his or her book, the first step in this process is to decide which words should go into the
    8·1 answer
  • Create the setStyles() function using the commands listed in the steps below. Christine wants one of five fancy style sheets to
    11·1 answer
  • covers a wide variety of applications such as web and computer-based training (CBT), and social networks. a. E-learning b. Model
    10·1 answer
  • Suppose that a class named ClassA contains a private nonstatic integer named b, a public nonstatic integer named c, and a public
    14·1 answer
  • 1.1.5 practice: analyzing business culture
    13·1 answer
  • Jason Chang is creating photos of his restaurant for a new website. Some of the photos of the staff have red eye, others are bad
    7·1 answer
  • Create a program named Auction that allows a user to enter an amount bid on an online auction item. Include three overloaded met
    11·1 answer
  • Which of the following statement is False? 1 point Context free language is the subset of context sensitive language Regular lan
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!