APCS-A Java Classwork: Number Conversions
Create two files:  ConvertBase.java and Numbers.java

ConvertBase.java
  • contains no 'main' method
  • contains no constructors
  • contains a static method named "convert"
    - has the following signature:  public static void convert(int num, int base)
    - is recursive
    - converts positive and negative base-10 integers to any base from 2 to 16
    - displays (does not return) the converted number

Numbers.java
  • a calling class
  • uses the "Scanner" class
  • does not perform any error trapping
  • contains a 'main' method
    - does not create a "ConvertBase" object
    - asks for and gets base-10 integers and bases (2 through 16) from the user
    - directly calls the "convert" method in the "ConvertBase" class for each pair of numbers
    - repeats the above two lines until the user enters zero (0) as a base-10 number


As always, all of your code must be your own, written entirely and
only by you within your online CodeHS.com account.  You must never
copy/paste, receive, view, or in any way use code that was created
or modified by another person, entity, or artificial intelligence.


Sample Input and Output from Run of Program
===========================================
Enter a positive or negative base-10 integer (zero to quit): 258748
Enter the base (between 2 and 16) into which you would like 258748 to be converted: 16
The base-16 representation of 258748 is: 3F2BC

Enter a positive or negative base-10 integer (zero to quit): 258748
Enter the base (between 2 and 16) into which you would like 258748 to be converted: 5
The base-5 representation of 258748 is: 31234443

Enter a positive or negative base-10 integer (zero to quit): -99
Enter the base (between 2 and 16) into which you would like -99 to be converted: 2
The base-2 representation of -99 is: -1100011

Enter a positive or negative base-10 integer (zero to quit): 99
Enter the base (between 2 and 16) into which you would like 99 to be converted: 13
The base-13 representation of 99 is: 78

Enter a positive or negative base-10 integer (zero to quit): 54922
Enter the base (between 2 and 16) into which you would like 54922 to be converted: 8
The base-8 representation of 54922 is: 153212

Enter a positive or negative base-10 integer (zero to quit): 54922
Enter the base (between 2 and 16) into which you would like 54922 to be converted: 2
The base-2 representation of 54922 is: 1101011010001010

Enter a positive or negative base-10 integer (zero to quit): 54922
Enter the base (between 2 and 16) into which you would like 54922 to be converted: 16
The base-16 representation of 54922 is: D68A

Enter a positive or negative base-10 integer (zero to quit): 0


Advanced Option
Add error trapping to your "Numbers" class.  Trap for the user providing
non-numerical input when asked to enter the numbers and bases.  Also error
trap for the user entering decimal numbers and base values that are less
than two or greater than 16.  If the user enters bad data, give a message
and then have the user re-enter the data.