Base_Change_GUI - johnelwart/Projects GitHub Wiki

Home

Problem Statement

The goal of this project is to make a GUI application that converts any two bases that are between base 2 and base 32. The program converts a value given by the user into the desired base also defined by the user. The output that the program calculates is displayed in the output window at the bottom of the GUI.

Developer Documentation

The BaseChangeTest class contains a method that loads the .fxml file generated by SceneBuilder and also defines some properties of the window itself. It also contains the main method that launches the program. The BaseChangeController class is more complex in that it contains all the components of the GUI, the method to convert bases, as well as other methods to format and/or validate the current value. The pressCalc method is called when the "Calculate" button is pressed. This method takes the text from the user in the input field and stores it in a variable called inValue. The method then converts the string to an ArrayList of Integers using the lettersToNums method. This method converts any letters the user typed into their respective values and adds the integer to the ArrayList of integers. The program then converts the given value in whichever base to base 10 first by default by adding the product of the value at an index and the base raised to the index. If the output base of 10 is chosen, the program outputs that number value. If the base is anything other than base 10, the value is divided by the chosen base and the remainders of each operation is stores in another ArrayList called remainders. The remainders ArrayList is then flipped using another one called temp and then the list is passed into numToLetters to convert any values greater than 9 to its respective letter value and returns a string to send to the output field.

User Documentation

When the user runs this program, a small window pops. The window contains a text field for the user to enter any value they choose and also two sliders, one representing the current base of their value and the other representing the base they wish to convert to. Both the sliders have a minimum value of 2 and a maximum value of 32, representing the range of bases the user can choose from to convert to and from. When the user has entered everything how they want they can press the Calculate button and the program will perform the proper calculation and display the result in the bottom of the window.

Source code

Source code