Question: Code is in Java. Ensure the input and output files are done through the command line arguments. Output file should have no blank lines. Any
Code is in Java. Ensure the input and output files are done through the command line arguments. Output file should have no blank lines. Any blank lines in input file are to be disregarded.
The problem: an only slightly confused number and symbol sorter
The task your system has to perform is to sort a given list of natural numbers and symbols in descending order. In addition to the usual ordering on natural numbers, we have the following requirements on how the symbols are integrated:
- 0 < Do < 1
- 100 < Re < 101
- 1000 < Mi < 1001
- 3 < & < 4
- 3 < @ < &
- 1005000 < % < 1005001
- 55 < Asymbolwithareallylongname < 56
- 20 < $ < 21
- 15 < Fa < 16
- 103 < One < 104
- One < Three < 104
- One < Two < Three
If the given list contains any number of 666, then the result list should be sorted in ascending order, without any occurences of 666, but with one @ added (even if the list already contains @s).
Input file
In an input file the given list for your system will be given by a line for each of the numbers/symbols in the list.
Output file
In the output file, you output the result list one number/symbol in its own line in the required order. If during reading of the input list, your system encounters an input that is not a natural number or one of the symbols given above, it has to output: Input error. and terminate. Regarding blanks and empty lines, the same requirements as in assignment 1 have to be fulfilled.
Basically create an algorithim that sorts natural numbers in descending order, then characters according to the rubric above. Input file has one element per line and no blank lines
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
