Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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 3000

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essentials of Database Management

Authors: Jeffrey A. Hoffer, Heikki Topi, Ramesh Venkataraman

1st edition

133405680, 9780133547702 , 978-0133405682

More Books

Students also viewed these Databases questions

Question

2. Be specific as to method of meeting all goals.

Answered: 1 week ago

Question

107 MA ammeter 56 resistor ? V voltmeter

Answered: 1 week ago

Question

Generally If Drug A is an inducer of Drug B , Drug B levels will

Answered: 1 week ago