Question: Write a Java application that will: Welcome the user Ask the user with prompts to enter integers (see the sample below) Read 4 integers into

Write a Java application that will:

Welcome the user

Ask the user with prompts to enter integers (see the sample below)

Read 4 integers into the program (no integers will be duplicates when tested)

Determine largest integer in the group using the compound && operator

By utilizing the compound "and" you can join multiple expressions. In Java you can do this using the && operator.

For example, to check if number1 greater than number2 and that number1 is greater than number3 use the following: if (number1 > number2 && number1 > number3) {

Then number 1 is the largest of the 3

} else {

Test to see if number2 is the largest using the same technique.

} else {

Test for number3

}

Determine smallest integer in the group using the techniques shown in the lectures standalone ifs.

For example:

smallest = firstNumber

If secondNumber is smaller than the first then {

smallestNumber = secondNumber

}

Now test the third etc.

6. Print the largest and smallest numbers with appropriate text

Use the % operator to determine if the smallest number is a factor or is not a factor of the largest.

Remembera number is a factor of another number if the first number can divide into the second number with no remainder.

Using the % (modulo) operator: largest % smallest should equal 0 if the smallest is a factor

Print with appropriate text whether or not the smaller is a factor of the larger

Calculate and display to 4 decimals the value of the largest number divided by the smallest number.

Remember to get a decimal answer when dividing integers you must cast one of the ints to a double or the decimal answer will be discarded

Only one of the integers should be cast

Use this guide: remainder = (double) largest / smallest;

Thank the user for using the software

Sample output

Write a Java application that will: Welcome the user Ask the user

Welcome to the Number Manipulator Please enter 4 integers separated by a space or on separate lines: 26 120 3317 17 is the smallest number. 120 is the biggest number. 17 is not a factor of 120 . 120 divided by 17 is 7.0588 Thank you for using the Number Manipulator

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!