8. do[num = num + 1 ;if (num * 2 〉 MAX + num)System.out.print (num + "");while (num - 7; value++)System.out.print (value " ");10. f r (int value = 7: value < 0; value-_)System. out.print (value + " w);11. for (int value - 1; value -20; value+-4)System.out.print (value + " W);12. for (int value -num; valueMAX; value++System.out.print (value " ");13. for (int value - num; valueMAX; value++)System.out.print (value " ");14. for (int value-MIN; value 〈-MAX ; value++)System.out.print (value " ");if(value%4!0)15. f r (int value = MAX ; value 〉= MIN; value-= 3)System. out.print (value + " w);

Question
Asked Mar 28, 2019
48 views

Assume the following declarations and initializations (MIN, MAX, num) are made just before each sub-question 1 to 15. What is the output each code?

8. do[
num = num + 1 ;
if (num * 2 〉 MAX + num)
System.out.print (num + "");
while (num <- MAX)
9. for (int value0 value >- 7; value++)
System.out.print (value " ");
10. f r (int value = 7: value < 0; value-_)
System. out.print (value + " w);
11. for (int value - 1; value -20; value+-4)
System.out.print (value + " W);
12. for (int value -num; valueMAX; value++
System.out.print (value " ");
13. for (int value - num; valueMAX; value++)
System.out.print (value " ");
14. for (int value-MIN; value 〈-MAX ; value++)
System.out.print (value " ");
if
(value%4
!
0)
15. f r (int value = MAX ; value 〉= MIN; value-= 3)
System. out.print (value + " w);
help_outline

Image Transcriptionclose

8. do[ num = num + 1 ; if (num * 2 〉 MAX + num) System.out.print (num + ""); while (num <- MAX) 9. for (int value0 value >- 7; value++) System.out.print (value " "); 10. f r (int value = 7: value < 0; value-_) System. out.print (value + " w); 11. for (int value - 1; value -20; value+-4) System.out.print (value + " W); 12. for (int value -num; valueMAX; value++ System.out.print (value " "); 13. for (int value - num; valueMAX; value++) System.out.print (value " "); 14. for (int value-MIN; value 〈-MAX ; value++) System.out.print (value " "); if (value%4 ! 0) 15. f r (int value = MAX ; value 〉= MIN; value-= 3) System. out.print (value + " w);

fullscreen
check_circle

Expert Answer

Step 1

Since these are separate blocks of code, for the purpose of demonstration we put the blocks in same Java class and show the execution output together. The questions taken up are from 8 to 15 as given. Also since the initializations of MIN, MAX, num are not given we assume suitable values by passing command line arguments. The program for the demonstration is given below:

class PrintDemo{

     public static void main(String args[]){

//run program using 3 command line arguments for num, //MIN, MAX

           int num = Integer.parseInt(args[0]);

           int MIN = Integer.parseInt(args[1]);

           int MAX = Integer.parseInt(args[2]);

           System.out.println("---------Q8----------");

           do{

                num = num +1;

                if(num * 2 > MAX + num)

                     System.out.print(num + " ");

           }while(num <= MAX);

           System.out.println("\n---------Q9----------");

           for(int value=0; value >= 7; value++)

                System.out.print(value + " ");

           System.out.println("\n---------Q10----------");

           for(int value=7; value < 0; value--)

                System.out.print(value + " ");

           Sy...

Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in

Engineering

Computer Science

Related Computer Science Q&A

Find answers to questions asked by student like you
Show more Q&A
add
question_answer

Q: Write a class in java with the name AgeMessages , which does the following:a. Ask the user to enter...

A: The algorithm for the program would be as below:Declare one float variable for accepting user inputP...

question_answer

Q: I need help answering the following quetions I am not good with code. 1. Describe how you use TCP Du...

A: Use the keyword tcpdump with the TCP Dump flag –D.The flag –D will list all the interfaces that are ...

question_answer

Q: define virtual memory

A: Virtual memory, in context with computing, is memory management technique that is used by the operat...

question_answer

Q: (Method Overloading) Given the following methods, write down the printed output of themethod calls: ...

A: Answer with Explanation:“doSomething(5)” contains an argument integer “5” and it is called to the “d...

question_answer

Q: How do you convert 172.16.20.55 to binary format?

A: 172.16.20.55 represents IP address in decimal format. In order to convert it into binary format we n...

question_answer

Q: Give an implementation of the macroinstruction searchleft (a, qi, qj), which indicates that the mach...

A: Turing machine uses “searchleft” for an implementation of the macroinstructions. If the machine read...

question_answer

Q: health informatics

A:  I think the student wants to know what health informatics is, so we will be providing a brief intro...

question_answer

Q: Cell Phones Records In this part, you are required to write a program, using linked lists, that man...

A: In the given question, some parts of the question are missing to use linked lists.Here, I have creat...

question_answer

Q: Create a new file in C++ and save it as lab12_XYZ.cpp  Consider rolling two six-sided dice. Whil...

A: Program Instructions:Declare the header files, constants, and prototypes.In main() call functions di...