In java write a program that takes four int command-line arguments w, x, y, z,. define a boolean variable whose value is true if the four values are either in strictly acending order (w<x<y<z) or strictly descending order (w>x>y>z), and false otherwise, then display the boolean variable value.
Note: Do not use if statements on the program
Note: Assume that the inputs will always be integers
The java program and its approach are given below: -
Java program: -
//defining the main class
public class Main
//defining the main method
public static void main(String a)
//declaring the variables
int w, x, y, z;
//the index of argument 'a' started from 0
//command line arguments are of string types
//parseInt() method is used to convert them into integers
//the value at first index is stored in the variable w
w = Integer.parseInt(a);
//the value at second index is stored in the variable x
x = Integer.parseInt(a);
//the value at third index is stored in the variable y
y = Integer.parseInt(a);
//the value at fourth index is stored in the variable z
z = Integer.parseInt(a);
//comparing the values of varible w, x, y, z
//res variable will store true if either of condition becomes true
res = (w < x && x < y && y < z) || (w > x && x > y && y > z);
//display the value of boolean varible either true or false
Program Screenshot with command-line arguments: -
Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*See Solution
Q: What are Content Delivery Networks and what are their functions?
A: Click to see the answer
Q: "What are a few things a good cyber security plan should include?
A: A good cyber security plan should include the following, A complete risk assessment of the user’s b...
Q: Write a class in Java 1) Consist of two methods: a. main b. printHigherThanAverage public stat...
A: In the main method – Make an object for a Scanner Declare an array to input the numbers of double t...
Q: Draw the logic diagram for the following Boolean expressions. The diagram should correspond exactly ...
A: OR gate is used where + is provided in the boolean expression.AND gate is used where .(or multiplica...
Q: No loops
A: The program is explained in detail with inlined comments. It uses the modulo operator % to find if t...
Q: Statistics are often calculated with varying amounts of input data. Write a program that takes any n...
A: The below given python program will obey the following rubrics:Displaying message to user to enter i...
Q: INPUT CONTROLS ANDNETWORKINGA global manufacturing company has over 100subsidiaries worldwide report...
A: Data security problems and control procedures: Problem 1:The headquarters received transmitted data ...
Q: How do Virtual Network Functions in software provide flexibility, agility and implementation speed f...
A: Virtual Network Functions involve implementing specific network functions on top of networking infra...
Q: What is the difference between Routing and Forwarding?
A: Routing A router is a procedure of choosing path along which the data can be moved from source to th...