Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Recall that A hex color is a nonnegative integer, n, that has a base 16 fixed-width 6 expansion n = (rir29192b1b2)16,6 where (rr2)16.2 is

image text in transcribed

1. Recall that A hex color is a nonnegative integer, n, that has a base 16 fixed-width 6 expansion n = (rir29192b1b2)16,6 where (rr2)16.2 is the red component, (g192)16,2 is the green component, and (b1 b2)16.2 is the blue. Color cycling is a way to form a sequence of hex colors. We start with a hex color case: The next element of the sequence after the current element, c, is ((256c) mod 16) + (c div 164). We continue finding new elements of the sequence until the calculation of the next element gives a hex color that is already in the sequence. Bonus - not for credit; do not hand in Why is each element of this sequence a hex color? (a) Find an example Chase such that the color cycling sequence that starts with it has exactly three elements. For full credit, include the base 16 fixed-width 6 expansion of each of the hex colors in the sequence, along with (clear, correct, complete) calculations for computing each next element in the sequence and confirming that there will be exactly three elements. (b) Find an example Cbase (different from the one in the previous part) such that the color cycling sequence that starts with it has exactly one element. For full credit, include the base 16 fixed- width 6 expansion of each of the hex colors in the sequence, along with (clear, correct, complete) calculations for computing each next element in the sequence and confirming that there will be exactly one element. (c) (Graded for fair effort completeness) A shade of gray is one where the red component, green component, and blue component all have the same color. To convert a color to grayscale, we can average its three component values and use this average as the grayscaled color's red component, green component, and blue component. Fill in the blanks in the following definition of the function grayscale by specifying its domain, codomain, and the rule for application. Challenge: your expression for the rule may use only n, constant integers, and the operations + (addition), - (subtraction), (multiplication), div (integer division), and mod (remainder). (You may not need to use all these operations.) grayscale : where, for each c grayscale(c) = 1. Recall that A hex color is a nonnegative integer, n, that has a base 16 fixed-width 6 expansion n = (rir29192b1b2)16,6 where (rr2)16.2 is the red component, (g192)16,2 is the green component, and (b1 b2)16.2 is the blue. Color cycling is a way to form a sequence of hex colors. We start with a hex color case: The next element of the sequence after the current element, c, is ((256c) mod 16) + (c div 164). We continue finding new elements of the sequence until the calculation of the next element gives a hex color that is already in the sequence. Bonus - not for credit; do not hand in Why is each element of this sequence a hex color? (a) Find an example Chase such that the color cycling sequence that starts with it has exactly three elements. For full credit, include the base 16 fixed-width 6 expansion of each of the hex colors in the sequence, along with (clear, correct, complete) calculations for computing each next element in the sequence and confirming that there will be exactly three elements. (b) Find an example Cbase (different from the one in the previous part) such that the color cycling sequence that starts with it has exactly one element. For full credit, include the base 16 fixed- width 6 expansion of each of the hex colors in the sequence, along with (clear, correct, complete) calculations for computing each next element in the sequence and confirming that there will be exactly one element. (c) (Graded for fair effort completeness) A shade of gray is one where the red component, green component, and blue component all have the same color. To convert a color to grayscale, we can average its three component values and use this average as the grayscaled color's red component, green component, and blue component. Fill in the blanks in the following definition of the function grayscale by specifying its domain, codomain, and the rule for application. Challenge: your expression for the rule may use only n, constant integers, and the operations + (addition), - (subtraction), (multiplication), div (integer division), and mod (remainder). (You may not need to use all these operations.) grayscale : where, for each c grayscale(c) =

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 Processing Fundamentals Design

Authors: Marion Donnie Dutton Don F. Seaman

14th Edition Globel Edition

1292107634, 978-1292107639

More Books

Students also viewed these Databases questions