Hello,
I'm in the process of writing a .java program that reads in 3 integer command-line arguments (we'll call them a, b, c).
The purpose of this program is to determine (by using a boolean declaration) whether or not the three values passed are in strictly ascending/descending order.
e.g.
% java Test 49 17 10
true
% java Test 10 49 17
false
The portion that is a little puzzling is how to use an "if else" statement to detect if the values are in ascending/descending order.
Here's what I have, please critique my code so I can improve! Thanks.
I'm in the process of writing a .java program that reads in 3 integer command-line arguments (we'll call them a, b, c).
The purpose of this program is to determine (by using a boolean declaration) whether or not the three values passed are in strictly ascending/descending order.
e.g.
% java Test 49 17 10
true
% java Test 10 49 17
false
The portion that is a little puzzling is how to use an "if else" statement to detect if the values are in ascending/descending order.
Here's what I have, please critique my code so I can improve! Thanks.
public class Ordered {
public static void main (String[] args) {
int firstNum = Integer.parseInt(args[0]);
int secondNum = Integer.parseInt(args[1]);
int thirdNum = Integer.parseInt(args[2]);
boolean isOrdered;
if (values are ascending or descending) {
isOrdered = true;
System.out.println(isOrdered)
}
else {
isOrdered = false;
System.out.println(isOrdered)
}
}