Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Well get to maths in a minute. First, you should create the main() function that you can use to test your program. Create a new
Well get to maths in a minute. First, you should create the main() function that you can use to test your program. Create a new class called HexiacosadecimalNumber. Within that class, create your main() function. The main function should behave as follows:
First, it should ask the user to indicate what mode it should be in. If the user types h or H, the program should ask them to input a hexaicosadecimal number (that is, a String). The program should then read that number into a variable and print it back to the command line (for now). If the user types d or D, the program should ask them to input a decimal number (that is, a double). The program should then read that number into a variable and print it back to the command line (for now). If the user types q or Q, the program should exit. If the user types anything else, the program should display the message INVALID INPUT, and then prompt the user again. The program should then ask the user again what mode it should be in and repeat the process until the user types q or Q at the prompt.
To accomplish this, you will need to use a Scanner object in combination with a loop containing an if-else block.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started