Question: Hello, I would like help answering this Java question. I am suppose to answer using if - else Statements as a beginner. Please explain in

Hello, I would like help answering this Java question. I am suppose to answer using if - else Statements as a beginner. Please explain in detail what you do.

Here is the question:

Assume the following rules:

  1. Two integers are "close" to each other if their values differ from each other by at most one.
  2. Two integers are "far" to each other if their values differ from each other by two or more.

Write a program that asks the user to input three int values, a, b, and c. Display true if one of b or c is "close" to a and the other is "far" from the other two. Otherwise, display false. Execution 1:

  1. Input integer 1: 1 Input integer 2: 2 Input integer 3: 10 Result: true

Execution 2:

  1. Input integer 1: 1 Input integer 2: 2 Input integer 3: 3 Result: false

Execution 3:

  1. Input integer 1: 10 Input integer 2: 8 Input integer 3: 9 Result: false

Execution 4:

  1. Input integer 1: -1 Input integer 2: 10 Input integer 3: 0 Result: true

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!