Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Were they made on a timely basis?

Answered: 1 week ago

Question

Did the decisions need to be made, or had they already been made?

Answered: 1 week ago