Question

3. Trace through the following loop and show the values for MiceOrdered, MiceSent, and MiceUsed. Declare MiceOrdered = 12 Dec
Value of MiceOrdered Value of MiceSent Value of MiceUsed Value of Mice Tested I need each one value
0 0
Add a comment Improve this question Transcribed image text
Answer #1

The loop will execute until MiceOrdered becomes equal to MiceSent i.e. the loop will keep executing till both the values MiceOrdered and MiceSent becomes equal to each other.

So initial values of variables are:

MiceOrdered = 12
MiceSent = 8
MiceUsed = 0
MiceTested = 4

As, the values of MiceOrdered(12) and MiceSent(8) are not equal now, so loop will execute. The change in all the values due to loop is shown below table:

9 Iteration Mice Ordered Micesent Mice Used Mice Tested 00 Initial Values It 1: IJs og oop og & Nool 08 As Mice Ordered = Mic

It denotes iteration number.

Add a comment
Know the answer?
Add Answer to:
I need each one value 3. Trace through the following loop and show the values for...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Hello, I need help understanding what happens to the value in each loop. I missed a...

    Hello, I need help understanding what happens to the value in each loop. I missed a lot of class so I need help. I decoded the final message but I'm supposed to fill in tables for each function. Homework 4: Program Trace Check out this “instructional” video on decoding strings - http://www.youtube.com/watch?v=zdA__2tKoIU Determine the output of the program below. You will receive no credit for a submission that shows no work. You must make variable tables and show how the...

  • use python and one loop to solve this problem Q6: Secondary Trace You are given a...

    use python and one loop to solve this problem Q6: Secondary Trace You are given a function that takes a square array, matrix, and returns the sum of the secondary diagonal values for matrix. This function employs a nested 2D for-loop. Write a function secondary trace single loop that solves the same problem using only one for-loop. For example, on the picture below secondary diagonal consists of values: a03, a12, a21, a30. a00 a01 a02 a03 a10 all a12 a13...

  • 6. Show the step-by-step trace through the following Fortran program segments and predict the output. a)...

    6. Show the step-by-step trace through the following Fortran program segments and predict the output. a) INTEGER I, J, K DO I = 2, 8, 2 DO J = I, 2 DO K = 1, J, 2 PRINT*, I, J, K ENDDO b) X = 1.0 DO WHILE (X .LE. 100.0) PRINT*, X X = (X-1)**2 + 2.0 END DO

  • Trace the evaluation of the following expressions, and give their resulting values. Make sure to give...

    Trace the evaluation of the following expressions, and give their resulting values. Make sure to give a value of the appropriate type (such as including a .0 at the end of a double or quotes around a String). 4 + 1 + 9 + "." + (-3 + 10) + 11 / 3 8 + 6 * -2 + 4 + "0" + (2 + 5) 1 + 1 + "8 - 2" + (8 - 2) + 1 +...

  • Ex 3) Trace the following flowchart for when input values are 12, 3, -3, 6, -11,...

    Ex 3) Trace the following flowchart for when input values are 12, 3, -3, 6, -11, -14, -1, -1, -3, 2, 0 and complete the trace table. Also, write pre- post-conditions for this flowchart start num output P p0 n0 num num 0 IT pp+1 num 0 nen+1 num #0 and ps 2 n IF end

  • Java The following questions ask about tracing a binary search. To trace the binary search, list...

    Java The following questions ask about tracing a binary search. To trace the binary search, list the value of first, last, and mid for each pass through the loop or method. Use one of these methods for your trace. public static int binarySearchIterative(int[] numbers, int target) { boolean found = false; int first = 0; int last = numbers.length - 1; while (first <= last && !found) { int mid = (first + last) / 2; if (numbers[mid] == target)...

  • write a java program that does the following Part one Use a For loop to compute...

    write a java program that does the following Part one Use a For loop to compute the sum of all the odd numbers from 1 through 99. Your result should be labeled, and the value should be 2500. Print your name 7 times using a While loop. String dogNames[ ] = {"Sam","Buster","Fido","Patches","Gromit","Flicka"}; Using the array defined here, print the values of the array vertically and horizontally using one For-Each loop. Reverse the logic (Nested loops: Indent text) so that the...

  • Hi, I need help with this practice problem! Chapter 2 Algorithm Discovery and Design 64C FIGURE...

    Hi, I need help with this practice problem! Chapter 2 Algorithm Discovery and Design 64C FIGURE 2.10 Get values for a and b If (either a 0orb 0) then Set the value of product to o se Set the value of count to 0 Set the value of product to 0 While (count <b) do Set the value of product to (product+ a) Set the value of count to (count + 1) End of loop Print the value of product...

  • Answer each of the following questions about loops in C++. In each question, LABEL the three...

    Answer each of the following questions about loops in C++. In each question, LABEL the three parts of the loop. a.) Write a while statement that will ask the user for integers until the user enters the sentinel value of -1. Declare all needed variables. b.) Write a for statement that will print out all the multiples of 3 between 1 and 200. Declare any needed variables. c.) Write a do while loop that will ask the user for characters...

  • 4. Perform a hand trace by producing a table of values for each of the variables...

    4. Perform a hand trace by producing a table of values for each of the variables in the following program. Similar to what you did in one of your labs. Note: Any computer generated output will be awarded a grade of zero. {4 points) #include <iostream> using namespace std; int main() { int low high; low = 1; high = 20; while (low < high) | cout << low << " " << high << endl; low = low +...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT