Question: IN JAVA Write a program named ZipOrder that the reads in three zip codes from standard input and prints to standard output one of three
IN JAVA
Write a program named ZipOrder that the reads in three zip codes from standard input and prints to standard output one of three words: "ASCENDING", "DESCENDING", "UNSORTED". The zip codes are guaranteed to be distinct from each other. In particular:
if each zip code read in is greater than to the previous one, "ASCENDING" is printed.
if each zip code read in is less than to the previous one, "DESCENDING" is printed.
otherwise, "UNSORTED" is printed.
The program accomplishes this by reading the zip codes and passing them as arguments to a method named direction. This method returns a string ("ASCENDING", "DESCENDING", or "UNSORTED") that the program prints out. The function carries out the zip code order logic.
CONSTRAINT: You must define and use the method direction.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
