Question: Write a Java program to demonstrate using command line arguments to convert numeric quantities with a certain radix (counting base) to base ten numbers. You

Write a Java program to demonstrate using command line arguments to convert numeric quantities with a certain radix (counting base) to base ten numbers. You will employ the use of String methods indexOf() and substring() as well as the Integer method parseInt().

Learning outcomes

  • Working with command line arguments.
  • Exposure to rudimentary parsing principles.
  • Working with String methods.
  • Working with Integer.parseInt().
  • Confirmation program produces desired results.

The strings in args will be the form value:radix where value is expressed with digits appropriate to the radix. So 16384:10 is 16384 as a base 10 number.

Use indexOf() to find the colon and gather the number and the radix using substring(). These values can be used to make a call to parseInt() to convert the numbers to base 10.

[NOTE: You are NOT allowed to use the split() method for this project.]

If the provided command line arguments were:

4eb:16 10110110:2 407:8 2048:10

Output should be similar to:

4eb base 16 is 1259 base 10 10110110 base 2 is 182 base 10 407 base 8 is 263 base 10 2048 base 10 is 2048 base 10

# PLEASE DONT COPY AND PAST AUTHORS'S ANSWER, BECAUSE IT'S CONFUSING , THANK YOU

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!