Question: In Java, please. Task 1: Parse 3 arguments specified as arguments from the command line of the program: one of the arguments will be in

In Java, please.

Task 1: Parse 3 arguments specified as arguments from the command line of the program: one of the arguments will be in decimal, one in binary, and one in hexadecimal. The numbers we specify will be unsigned integers (i.e., the numbers are positive, whole numbers). If an incorrect number of arguments is provided, you should print an error and exit.

Task 2: Identify the numbering system that each of the arguments refers to. This should occur regardless of the order in which the numbers are specified. 1. A binary number will have a 0b prefix. For example, the binary number 0b101011001 represents the decimal number 345 2. A hexadecimal number will have a 0x suffix. For example, the hexadecimal number 0x159 represents the decimal number 345 3. If either prefix 0b or 0x has not been specified, then that number should be considered a decimal number.

Task 3: Error checking: 1. A binary number should not contain anything other than a 0 or 1. 2. A decimal number should only comprise digits 0 through 9. 3. A hexadecimal number contains digits 0 through 9, and letter A through F either in lowercase or uppercase. If any of the above validations fail, print an error and exit.

CAN NOT USE:

Build a GUI

(1) Integer.parse or Parse.Int

(2) Integer.toHexString

(3) Integer.toBinaryString

(4) Built in bitwise operations (~, ^, |, &, <<, >>) Note: Logical operations are allowed (!, ||, &&, etc.)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!