assg2 - CSC1520 Computer Principles and C+ Programming,...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CSC1520 Computer Principles and C++ Programming, 2009 Fall Department of Computer Science and Engineering, The Chinese University of Hong Kong Assignment 2: HKID Due: 23:59:59, 12 Oct 2009 (Mon) Full marks: 100 Introduction Every Hong Kong identity card (HKID) has a number which consists of three parts: (1) one or two alphabets (mostly one), (2) six digits, and (3) one digit in bracket which is called the check digit , e.g., C668668(9). The check digit is for facilitating computer data processing and error checking. In this assignment, you will write a program to compute the check digit of an HKID number. For simplicity, we consider only the common case where there is one alphabet in the HKID number . Let be an HKID number without the check digit, where is the alphabet and are the six digits. The check digit of the HKID number can be computed using the following algorithm: abcdefg a bcdefg 1. Convert the alphabet into a number which represents the alphabetical order of the alphabet. That is, ‘A’ is 1, ‘B’ is 2, ‘C’ is 3, …, and ‘Z’ is 26. a 2. Compute the weighted sum of the HKID number using the following formula: g f e d c b a S × + × + × + × + × + × + × = 2 3 4 5 6 7 8 3. Find the remainder of
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

assg2 - CSC1520 Computer Principles and C+ Programming,...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online