Question
Question 2: Input Analyzer Program Attached to this assignment is a file called InputAnalyzer.java. Note that there is a marked section where your code must
Question 2: Input Analyzer Program
Attached to this assignment is a file called InputAnalyzer.java. Note that there is a marked section
where your code must go. The code outside of this area must not be modified.
Let a,band cdenote the three numbers the program receives as input arguments. Write Java code in
the marked area of the provided file to display the following information:
1. Whether or not a,band care all non-negative numbers.
2. Whether or not at least one between a,band cis an odd number.
3. Whether or not a,band cwere entered in a strictly decreasing order.
4. Whether or not a,band care all non-negative numbers or entered in a strictly decreasing order.
5. Whether or not a,band care all non-negative and none of them is odd.
Lets look at three examples:
1. If the program is run with input arguments 9,8and 0then the output should be:
The numbers 9.0, 8.0, and 0.0 are all non-negative: true
At least one between 9.0, 8.0, and 0.0 is odd: true
The numbers 9.0, 8.0, and 0.0 are in strictly decreasing order: true
The numbers 9.0, 8.0, and 0.0 are either all non-negative or in a strictly decreasing order: true
The numbers 9.0, 8.0, and 0.0 are all non-negative numbers and none of them is odd: false
2. If the program is run with input arguments 31.3,-3.2 and -10 then the output should be:
The numbers 31.3, -3.2, and -10.0 are all non-negative: false
At least one between 31.3, -3.2, and -10.0 is odd: false
The numbers 31.3, -3.2, and -10.0 are in strictly decreasing order: true
The numbers 31.3, -3.2, and -10.0 are either all non-negative or in a strictly decreasing order: true
The numbers 31.3, -3.2, and -10.0 are all non-negative numbers and none of them is odd: false
3. If the program is run with input arguments 5,5and -3 then the output should be:
The numbers 5.0, 5.0, and -3.0 are all non-negative: false
At least one between 5.0, 5.0, and -3.0 is odd: true
The numbers 5.0, 5.0, and -3.0 are in strictly decreasing order: false
The numbers 5.0, 5.0, and -3.0 are either all non-negative or in a strictly decreasing order: false
The numbers 5.0, 5.0, and -3.0 are all non-negative numbers and none of them is odd: false
Be sure to include the specified text on each output line. That is, concatenate a String literal with the
value of a variable. Note that, if you find yourself writing the same expression more than once, this is
a good place to introduce a new variable. It will make your code more readable, easier to write and to
maintain.
As for the previous question, this program is run by providing input arguments. Check out the informa-
tion provided above to make sure you wrote your program correctly.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started