A stack can be used to print numbers in other bases (multibase output). Examples:

a)(Base8) 2810 = 3 * 81 + 4 * 80 = 348

b)(Base4) 7210 = 1 * 43 + 0 * 42 + 2 * 41 + 0 * 4 = 10204

c)(Base2) 5310 = 1 * 25 + 1*24 + 0 * 23 + 1 * 22 + 0 * 21 + 1 * 20 = 1101012

Write a java program using stacks that takes 3 non-negative (base 10) long integer numbers and a base B (B is in the range 2-9) and writes the number to the screen as a base B number. The program prompts the user for 3 numbers and bases, and then outputs them.

Use as input:

a)7210 Base 4

b)5310 Base 2

c)355310 Base 8

1.Show the ListStackADT< T > interface

2.Create a ListStackDataStrucClass< T > with the following methods: default constructor, overloaded constructor, copy constructor, getTop, setTop, isEmpty, ifEmpty (if empty throw the exception), push, peek, pop, toString.

3.Create a private inner class of ListStack< T > called StackNode< T > with the following methods: default constructor, overloaded constructor, copy constructor, getValue, getNext, setValue, setNext

4.Create a BaseConverter class (non-generic) with the following methods: default constructor, inputPrompt, convert [converts a BaseNumber to a converted String], convertAll [instantiate a String object] , toString, processAndPrint

5.Create a private inner class BaseNumber. The inner class has the following methods: default constructor, overloaded constructor, getNumber, getBase, setNumber, setBase. [Make your private instance variables in the inner class Long type].

6.Create a BaseConverterDemo class that only has 2 statements: Create a BaseConverter object and then have it invoke processAndPrint.

7.Exception classes: StackException, EmptyStackException, FullStackException

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.