Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. In the following expressions indicate the resulting value. Assume: int ii = 4; int jj = 7; double xx = 12.0; double yy =
1. In the following expressions indicate the resulting value. Assume: int ii = 4; int jj = 7; double xx = 12.0; double yy = 5.0; String ss = "Hello"; String tt = "World"; System.out.println( 19 % 5)); double zz = jj / ii; z = (ii > jj) || (xx != yy) 4 & 11 * jj / 3 System.out.println( aj / ii + jj & ii)); System.out.println( ss.substring (1,3)); System.out.println( (ss.compareTo ( tt ) yy) || ((yy + zz) >= (xx - zz))) bb = 2. What is the final value of xx in each example? int xx = 0; if (xx 0) xx = xx + 1; xx = xx + 3; if (xx >= 1) xx = xx + 2; System.out.println( xx); 3. Evaluate each for xx: int xx = -1; if (xx 0) xx = xx - 5; else xx = 20; int xx = -1; if ( xx 0) x = xx - 5; xx = 20 4. Write a single if-test using Boolean operators and relaional operators to determine if a double variable x is between zero (exclusive) and one (inclusive). Print a message indicating that x is between zero and one inclusive. Use de Morgan's law to show the complement of the previous if-test. Simplify the complement statement so there is no "!" in your final if-test statement. 5. In the following questions, assume Boolean values have been assigned to A, B, and C as follows: boolean AA = true; boolean BB = false; boolean cc = true; Indicate what is printed by each statement: System.out.println( ((AA && BB) || (AA && CC)) ); System.out.println( ((AA || !BB) && (!AA || CC) ); 6. Write a program to determine if an input integer is an even number or odd number. 7. How can the effect of the following program fragment best be described? if (x > y) z = x; if (x == y) z = 0; if (x 6; i -=5 ) { sum -= i; System.out.println("3: sum = " + sum + " i -" + i); int i = 1; int total = 50; while (i
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