Lab 7: Itecalculator: Numbersystemconversion Hex2Binary Hex2Octal Hex2Decimal
Lab 7: Itecalculator: Numbersystemconversion Hex2Binary Hex2Octal Hex2Decimal
LAB 7: ITECalculator
In lab 6, you have create number system conversion that will be able to convert from
binary, octal, and decimal. but you have not done hexadecimal and protected against the
user input yet. In this lab, you will add helper methods that can be used to protect against
the user input and do hexadecimal.
Hexadecimal
Hexadecimal to Binary
Hexadecimal to Octal
Hexadecimal to Decimal
isValidBinary: The helper method that receive String that the user inputs and
check whether it is valid binary numbers or not. If the input String is valid
numbers in binary, this function will return the true. Otherwise, false.
សាកលវ ិទ្យាល័យភូមិន្ភ
ទ ំពន េញ Java Programming
មហាវ ិទ្យយល័យវ ិស្វកមម ពោកគ្រូ៖ ពោ ស្ុខជា
ឆ្នទ្យ
ំ ី២ ឆមាស្ទ្យី១ Lab 7
isValidOctal: The helper method that receive String that the user inputs and
check whether it is valid octal (0-7) numbers or not. If the input String is valid
numbers in octal, this function will return the true. Otherwise, false.
isValidDecimal: The helper method that receive String that the user inputs
and check whether it is valid decimal numbers or not. If the input String is
valid numbers in decimal, this function will return the true. Otherwise, false.
isValidHex: The helper method that receive String that the user inputs and
check whether it is valid hexadecimal numbers or not. If the input String is
valid numbers in hexadecimal, this function will return the true. Otherwise,
false.
E. In the main function, please use this function check whether what the use input is
a valid number or not by using this function. If it is a valid, you can start to convert
it.