JCE Computer Studies study materials
JCE Computer Studies study resources

Membership Cards for a Community Library

JCE Computer Studies · Put your knowledge to work in context.

All case studies

Membership Cards for a Community Library

A community library wants to issue 1,200 membership cards. Each card stores a 12-digit decimal membership number; surname and initials as 30 ASCII characters; a membership category with five possible values; a photograph at 240 by 320 pixels using 24-bit colour, compressed to one-eighth of its uncompressed size; and a 512-byte fingerprint template. The library has 64 MB flash cards, but the card firmware reserves 15 percent for formatting and metadata. Cards must remain readable for five years, and the librarian wants to know whether the photo can be upgraded to 480 by 640 pixels at the same colour depth and compression. Assume 1 MB equals 1,048,576 bytes and 1 KB equals 1,024 bytes.

1. Calculate the storage needed for 1,200 cards at the original photo resolution. State your assumptions and decide whether the 64 MB cards are adequate.

Read the worked answer

Available card space is 64 x 1,048,576 x 0.85 = 57,042,534 bytes, about 54.4 MB, or 47,535 bytes per card for 1,200 cards. The 240 by 320 photo has 76,800 pixels. At 24-bit colour it needs 76,800 x 3 = 230,400 bytes; compressed to one-eighth, 28,800 bytes. Store the 12-digit number in packed BCD: about 6 bytes. The name needs 30 ASCII bytes, the five-value category can use one byte, and the fingerprint template needs 512 bytes. Total per card is 28,800 + 6 + 30 + 1 + 512 = 29,349 bytes. For 1,200 cards this is 35,218,800 bytes, about 33.6 MB. This fits inside 54.4 MB with about 21.8 MB spare. The cards are adequate if the stated 15 percent is the only overhead and the fingerprint template does not grow.

2. The librarian wants to upgrade every photo to 480 by 640 pixels at 24-bit colour and still use the same cards. Evaluate this proposal and give two alternative encoding changes that would make it feasible.

Read the worked answer

At 480 by 640 there are 307,200 pixels. At 24-bit colour the uncompressed photo is 307,200 x 3 = 921,600 bytes; one-eighth compression gives 115,200 bytes. Adding 6 bytes for the number, 30 for the name, 1 for category and 512 for the fingerprint gives 115,749 bytes per card. For 1,200 cards that is 138,898,800 bytes, about 132.5 MB, which is far above the 54.4 MB available. The proposal fails at 24-bit colour and one-eighth compression. One alternative is to reduce colour depth to 8-bit: the compressed photo becomes 307,200 / 8 = 38,400 bytes, giving 38,949 bytes per card and 46,738,800 bytes in total, which fits. A second is to keep 24-bit colour but increase compression to about one-thirty-second, bringing the photo back to roughly 28,800 bytes. Reducing resolution or shortening the name field would also help, but the library should test readability before choosing.