Question: Write a class called TwoNumbers which will ask the user for two double numbers and print out comments based on their values. There is no

 Write a class called TwoNumbers which will ask the user for

Write a class called TwoNumbers which will ask the user for two double numbers and print out comments based on their values. There is no starter file and you will write all the code. Use this exact prompt to get input: System.out.print("Enter two numbers (like this: 41.7 -22.5): "); The user can enter both numbers on the same line at the same time. This is possible because the first call to nextDouble will skip any leading whitespaces and then read up to the next whitespace (the space), leaving that whitespace in the input stream. The second call to nextDouble will ignore leading whitespaces and then read up to the next whitespace (the newline) leaving the newline in the input stream. This is a handy way to request multiple inputs. Here are the conditions and the comments to print. Comment Condition ||first is equal to second first is greater than second first is less than second the numbers are within .0001 of each other the numbers are more that 10000 apart they have the same sign/different sign The first number is equal to the second The first number is greater than second The first number is less than second The numbers are close together The numbers are far apart The numbers have the same/different sign If the numbers are equal only print the one message. Otherwise print all that apply in the order given above. Copy and paste the prompt and the replies. That way you will have exactly what Codecheck expects. Use the appropriate if structure and do not just use all ifs. Note for advanced students: Do not use System.exit()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!