Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function that converts a bitmap image of a digital clock (represented as a string of the form: hh:mm ) into its representational bit

image text in transcribed

image text in transcribed

Write a function that converts a bitmap image of a digital clock (represented as a string of the form: hh:mm ) into its representational bit string. A bitmap image is a by-product of parsing bits ( 0 's and 1 's) from a canvas which is basically an image in black on a white background, where represents the white background and 1 represents the black pixel (it's what an image is composed of, technically). The general idea of this challenge is to encode a bitstring that reflects the image of a digital clock (of this format: hh:mm ). The images below are basic examples of how these are conceived. The clock face shows the time in a black on white background where each character is three cells wide and five cells deep. Notice there is a space between the numbers represented by a column of blank cells: Each image is 17 bits wide by 5 bits deep. Each row is encoded as a 17 character string of 1s and 0s and the five rows are then concatenated into an 85 character string. For example, the above image is encoded as follows: row3="10100100001110111"row4="10100100100010001"row5="11101110001110111"bitmap>"111001000011101111010110010001010010100100001110111101 Looking at the above rows and examining it carefully, you should be able to see the clock digits in the pattern of 1 's. The first three columns show the number , followed by a column of all 0 s representing a space between the numbers, then comes another three columns representing the number 1 , then three columns representing the character then three columns representing 3 , a column of zeroes representing a space and finally three columns representing the number 5 . The resulting time is Example toBitstring("05:44")"1110111000101010110101000101010101101011toBitstring("12:13")"0100111000010011111000010101100001010011toBitstring("12:17")"0100111000010011111000010101100001010011toBitstring("06:46")"1110100000101010010101000101010100101011

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

Oracle Database 10g Insider Solutions

Authors: Arun R. Kumar, John Kanagaraj, Richard Stroupe

1st Edition

0672327910, 978-0672327919

More Books

Students also viewed these Databases questions