Question: 9. Explain why comparing floating point numbers for equality can be different than comparing integer numbers for equality. 10. Describe the conditions when integer arithmetic

9. Explain why comparing floating point numbers for equality can be different than comparing integer numbers for equality. 10. Describe the conditions when integer arithmetic is exact. 11. Describe the conditions when integer arithmetic is not exact. 12. Let strl = "Columbia" and let str2 = "Columbus". Show how to write an if-test to determine if the two variables, strl and str2, contain matching strings using the obj1.equals( obj2) instance method. 13. Write a program fragment that will write two string in alphabetical order given that the two strings are unknown when the program begins. 14. Write a program to compare two numbers against a tolerance (epsilon). Display the numbers are within the tolerance when the two numbers are with the tolerance; otherwise, display the numbers are not within the tolerance": a-b SE , where & is epsilon. max(al,bl) 35 15. Write a switch statement to print the correct number of seats given the room number from the table: Room # Seats 105 106 110 All other 45 rooms Make the switch statement as efficient as possible by combining similar items into one case. 35 80 16. Trace the loops: int i; int sum = 100; for( i = 20; i>6; sum -= i; i -=5 ) { 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
Get step-by-step solutions from verified subject matter experts
