|
Assignment #7
Goals: Ø This lab gives students more experience in · Top-down Design and procedural abstraction. · Good style programming
Background Information
Roman Numbers. The Roman Number System has seven digits as follows:
I 1 V 5 X 10 L 50 C 100 D 500 M 1000
Numbers are formed according to the following rules:
1. Only numbers up to 3999 are represented. 2. As in decimal system, the thousands, hundreds, tens, and ones are expressed separately. 3. The numbers 1 to 9 are expressed as shown. As you can see, an I preceding a V or X is subtracted from the value, and you can never have more than three I’s in a row. I II III IV V VI VII VIII IX4. Tens and hundreds are done the same way, except that letters X, L, C, D, M are used instead of letters I, V, X. Requirement: Write an algorithm and then a structured program that converts a positive integer into Roman Number System. Your program shall take, as input, a number such as 1978, and convert it to its equivalent in the Roman Number System as MCMLXXVIII.
Marking Scheme [3 marks] Presentation/Style: Organization, readability, descriptive identifier, indentation, bracket placement. [14 marks] Correctness: Program works without bugs. Appropriate us of methods. [3 marks] Documentation: Internal
此源码经过详细测试 保证能运行!!!
下载地址: 游客,本付费内容需要支付 100金币 才能浏览 支付
|