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 initial values of cache tags and cache lines

Assuming that the initial values of the cache tags and the cache lines are completely arbitrary, Also, show how the cache tags will change for each of the above steps. You should justify your answer.

  Explain response time for jobs in observed system

Explain the response time for jobs in observed system? As function of N, number of terminals, give high-load bounds for throughput and response time; also provide low-load bounds.

  Explaining problem-solving and brainstorming skills

Use problem-solving and brainstorming skills to find out a procedure to follow. Write down a one-page report outlining what to do.

  Write a turing machine that takes as input

Write a Turing machine that takes as input the unary representation of any two different numbers, separated by a blank, and halts with the representation of the larger of the two numbers on the tape.

  Aspects of negotiation will point out it is proceeding well

What aspects of negotiation will point out it is proceeding well or poorly? What will tell you that it is time to arrange further meeting? What signs will you utilize to decide when change in negotiators is necessary?

  Determine access time when there is cache miss

Determine the access time when there is cache miss? Suppose that cache waits until line has been fetched from main memory and then re-executes for hit.

  Create supply chain management system

What are some of the reasons that RMO decided to build supply chain management system previous to customer support system?

  Explain classic five-stage risc integer pipeline

Assume that the initial value of R3 is R2 + 496. Use the classic five-stage RISC integer pipeline and assume all memory accesses take 1 clock cycle.

  Basic forms of conducting international business

Discuss the basic forms of conducting international business, and basic international business strategies.

  Experts suggest regarding search for information on internet

Which of the following do experts recommend regarding the search for information on the Internet? Avoid Boolean operators since new technology has made them obsolete.

  Factors finding whether something is politically feasible

Describe political feasibility. What factors go into determining whether something is politically feasible in an organization? Answers may include whether a sponsor exists

  Question in unix os

What if we need the portion from a text based on some keyword. Now i want the middle portion where i found EO427849242. I tried with sed but it does not give me the desired result.

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