Question
Write a Java program that will display decimal integer values as both hexadecimal and binary representations and will hightlight the different representations with different colors
Write a Java program that will display decimal integer values as both hexadecimal and binary representations and will hightlight the different representations with different colors (reset, black, red, green, yellow, blue, magenta, cyan, white). First create a color enum that will store the 9 color values of 3-bit ANSI.
Then write a driver class with a main(), validate(), and display() that will explain the purpose of the class to the user, ask them for a decimal value. Will validate the user input and if it is valid, will display the value in binary, hex, and decimal in the appropriate colors.
Attached is a picture of what the output of the program should look like
Welcome to Number Converter 3000! This program will take a decimal number and convert it to binary and hexadecimal representations Decimal will be displayed in blue Hexadecimal will be displayed in red Binary will be displayed in green Please enter a number to convert (or q to quit) yo mama Please enter a number to convert (or q to quit) 39 Decimal: 39 Hexadecimal: 0x27 Binary: 100111 Please enter a number to convert (or q to quit) 31957 Decimal: 31957 Hexadecimal: 0x7CD5 Please enter a number to convert (or q to quit) Thank you for using Number Converter 3000! Welcome to Number Converter 3000! This program will take a decimal number and convert it to binary and hexadecimal representations Decimal will be displayed in blue Hexadecimal will be displayed in red Binary will be displayed in green Please enter a number to convert (or q to quit) yo mama Please enter a number to convert (or q to quit) 39 Decimal: 39 Hexadecimal: 0x27 Binary: 100111 Please enter a number to convert (or q to quit) 31957 Decimal: 31957 Hexadecimal: 0x7CD5 Please enter a number to convert (or q to quit) Thank you for using Number Converter 3000Step 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