Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What are negative messages? (Objective 1)

Answered: 1 week ago