Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C ++ program .. (this code should run in C++) HEX/RGB Converter In this program you are to present a User with a menu. The

C ++ program .. (this code should run in C++)

HEX/RGB Converter

In this program you are to present a User with a menu. The menu should have the following options:

Enter RGB values

Enter HEX value

Exit

Your program can assume integer input.

If an input is outside of the range of values, you should display an error message, and re-display the menu.

When the User selects Option 1, you will prompt them for a red, green, and blue value. For example:

Enter a value for Red (0-255): 200

Enter a value for Green (0-255): 130

Enter a value for Blue (0-255): 57

Your program can assume integer input with the specified range

Upon entering the values, your program should display the hexadecimal representation of the RGB values entered. Below is an example:

RGB( 200, 130, 57 ) = 0xC88239

Conversely, if the User selections Option 2, You should prompt the User for a 6-Character hex value, and display the corresponding RGB values. For example:

Enter a hex value: C88239

0xC88239 = RGB( 200, 130, 57 )

Your program can assume the input is a valid uppercase 6-character hex value

Your program should continuously loop until Option 3 is selected.

ConverterClass

To solve this problem, you are to implement a Converter class that contains 2 constructors.

One constructor will take a string that represents a 6-character hex value.

The second constructor will take 3 integer values the represent a red, green, and blue channel respectively.

To display the results, you should use accessors to print the required values.

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

Step: 3

blur-text-image

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

Database Driven Web Sites

Authors: Mike Morrison, Joline Morrison

1st Edition

061901556X, 978-0619015565

More Books

Students also viewed these Databases questions

Question

How do Data Types perform data validation?

Answered: 1 week ago

Question

How does Referential Integrity work?

Answered: 1 week ago