Question
int vOne = 15; int vTwo = 32; String vThree = Three is the key; String vOut = nada; if (vOne + vTwo == 46
int vOne = 15; int vTwo = 32; String vThree = "Three is the key"; String vOut = "nada"; if (vOne + vTwo == 46 && vTwo % 10 == 0 || vThree.length() > vOut.length()){ vOut = "woopie"; } System.out.println("If-else A: " + vOut); vOne = 18; vOut = "green"; if (vOne <= 20){ vOut = "pink"; }else if (vOne <= 10){ vOut = "black"; }else if (vOut.charAt(4)=='n'){ vOut = "blue"; }else{ vOut = "red"; } System.out.println("If-else B: " + vOut); int compare = "HELLO".compareToIgnoreCase("hello!"); if (compare < 0) System.out.println("If-else C: pink"); else if (compare > 0) System.out.println("If-else C: black"); else System.out.println("If-else C: blue"); //----------------------------------------------------------------- total = 0; for(cntr=1; cntr<20; cntr+=2){ total++; } System.out.println("For A: " + total); String str = ""; for(cntr=4; cntr<10; cntr+=2){ int amper = cntr % 3; if (amper == 0) str = str + "A"; else if (amper == 1) str = "B" + str; else str = str.substring(1, 2); } System.out.println("For B: " + str); total = 0; for(int c1 = 1; c1 > -1; c1--){ for(int c2 = 0; c2 < 3; c2++){ total = total + c1 - c2; } } System.out.println("For C: " + total); total = 0; for(int c1 = 1; c1 < 3; c1++){ for(int c2 = 0; c2 < c1; c2++){ total = total + c1; } } System.out.println("For D: " + total);
If-else A: _____ ? If-else B: ____ ? If-else C: ____ ? For A: ____ ? For B: ____ ? For C: ____ ? For D: ____
A. blue B. -3 C. true D. woopie E. A F. black G. pink H. 75 I. 10 J. nada K. 5
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started