Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Students also viewed these Databases questions