Encode or decode a color combination

Assignment Help Basic Computer Science
Reference no: EM13165283

In the early days of computer graphics, colors where represented as two numbers. The first number was the foreground color and the second was the background color. These two values, which ranged from 0 to 15 were stored within a single byte; the foreground color being the upper four bits and the background color being the lower four bits.

Write a program that will ask a user if they wish to encode or decode a color combination. For the encoding, the user can only enter values between 0 and 15 for either the foreground or background color, and then the program will display the numerical value obtained when the foreground color is placed in the upper four bits and the background color is placed in the lower four bits.

For decoding, the user will enter a number between 0 and 255 (the maximum value for 8 bits), and the program will print out the numbers for the foreground and background colors.

Reference no: EM13165283

Questions Cloud

Develop an approach that will automatically integrate error : Develop an approach that will automatically integrate error messages and a user help facility. That is, the system would automatically recognize the error type and provide a help window with suggestions for correcting it. Perform a reasonably complet..
Study of prosocial behavior : By-stander behavior is an important topic within the study of prosocial (helping) behavior. Apply the well-known and respected by-stander research of Latane and Darley to this scenario:
F does not logically imply : Given R = (J,K,L ) and the set F of FDs J -> K and L -> K , show that F does NOT logically
Variables should be private and the class functions public : All the class variables should be private and the class functions public. The class functions should be implemented in a file Inventory.cpp which should be linked with the inventory.hpp file.
Encode or decode a color combination : In the early days of computer graphics, colors where represented as two numbers. The first number was the foreground color and the second was the background color. These two values, which ranged from 0 to 15 were stored within a single byte; the fore..
Offer activities to promote diversity : "Many organizations sponsor or offer activities to promote diversity.  What types of activities or trainings do organizations offer to ensure/promote a diverse company.
This program will simulate the game of hearts : This program will simulate the game of Hearts, which is a four-player trick-taking game using any ordinary deck of playing cards. Each player is dealt thirteen cards. Whoever is dealt the Two of Clubs must lead it to the first trick. Each person p..
Harassment prevention training : What are some of the reasons an organization should have harassment prevention training?  Even though our text focuses on sexual harassment, which groups of people, in addition to women, can be targets of harassment? "
Efforts against terrorism more effective : If the United States is NOT making progress, what would have to happen to make the efforts against terrorism more effective?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Explaining dui and charges of domestic violence

You will be handling sensitive information and may end up in court as a technical or expert witness. How can things such as a DUI, charges of domestic violence and other items affect your career?

  Tools to perform project management processes

Describe in scholarly detail the tools and techniques that are used for prforming project management processes.

  Draw a circuit which implements a 1-to-2 decoder

Q1. Write the truth table for a 1-to-2 decoder. Draw a circuit which implements a 1-to-2 decoder using AND gates, OR gates and NOT gates only.

  Data blocks accesses to fetch record using linear search

How many data blocks accesses on the average are required to fetch the record using linear search? How many data blocks accesses are required to fetch a record using binary search?

  How will decision meet accessibility guidelines

Knowing that this violates Redundancy Principle, but wanting to accommodate employees with disabilities, what would you suggest instead? How would your decision meet accessibility guidelines?

  You have 10 stacks of coins

You have 10 stacks of coins, each consisting of 10 quarters. One entire stack is counterfeit, but you do not know which one. You do know the weight of a genuine quarter and you are also told that each counterfeit quarter weights one gram more than it..

  How procuring organization has sorted out problem

You are the engineer involved in development of financial system. Should you simply abandon work until procuring organization has sorted out problem?

  Study evidence for defence in law firm

You are engaged by law firm to study evidence for the defence. You uncover evidence that doesn't help your client's case but was not discovered by the prosecution.

  We are interrupted or disintegrated

Research is compelling that it takes us approximately 4 to minutes return to our work with the same level of through processes whenever we are interrupted or disintegrated. Is it possible to information is fairly constant?

  How pms allot preservation treatment to candidate project

1. Does PMS allot preservation treatment to candidate project? 2. If answer to question 1 is Yes or Under Development, which groups of treatments does PMS cover?

  Explain organizations pools markets and expertise

When output of some units can be used as inputs to othe units, or if two organizations pools markets and expertise which results in lower costs and generate profits it is frequently referred to as creating?

  Banning in us all forms of cloning a good thing

Is banning in the US all forms of cloning a good thing? Or is this not one of those situations where one size fits all?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd