Write a LMC program that can convert an n-bit binary number into a decimal number. Display the natural number as output before halting the program. The first input determines the value for n. It is assumed this value will be equal to four, or greater. For example, if the first input is eight (8) then eight subsequent inputs are requested. If the subsequent inputs number were 1, 0, 0, 1, 0, 0, 0, 0 then the output would be 9. n input values are provided by the user, one for each bit:
The first of these is the least-significant bit. The n’th input is the most-significant bit. Q1. Describe your approach to solving the problem. Use natural language, structured like a conventional programming language to communicateyour design. When necessary, use looping and conditional constructs. Name symbols sensibly to make their use clear. Q2. Draft a test plan to be used as a verification method to ensure that your LMC programiscorrect. Tabularise test input value(s) and the expected output(s)
Consider uncommon cases. For example, when the calculator reaches its maximumvalue, when negative values are calculated, or when an input is unexpectedly large. Draft your test plan using the following template (two examples are provided):
Comma-separate the input and output values. Delete the examples.
Input Value(s)
Expected output
value(s)
Notes
2,4,6 10 All even numbers
1,3,5 9 All odd numbers
Q3. Implement an LMC program according to the algorithm you designed in Q1. Use the test suite you designed in Q2 to verify the implementation of your algorithmis
correct. Only symbolic addressing is to be used; numerical addressing will be disabled. LMC program must request the correct number of input(s). LMC program must produce the correct number of output(s). LMC program must produce the correct output value(s) for all given test cases. Code must be tidy (spacing, indentation) and comments are to be used to describe the
algorithm. Do not describe the function of each LMC instruction. Your LMC file should show the full history of how your solution was implemented. Use LMC IDE v1.5.0.0 (or greater)
请加QQ:99515681 邮箱:99515681@qq.com WX:codinghelp
-
Zymeworks Announces FDA Clearance of Investigational New Drug Application for ZW171, a novel 2+1 T-cVANCOUVER, British Columbia, June 17, 2024 (GLOBE NEWSWIRE) -- Zymeworks Inc. (Nasdaq: ZYME), a clinical-stage biotechnology company developing a di2024-06-17
-
Indonesia Stock Exchange Partners with Nasdaq to Upgrade Market InfrastructureTechnology partnership will further enhance overall resilience and integrity of the exchange, while supporting the rapid deployment of new products2024-06-17
-
Adalvo 的 Liraglutide 預充式注射筆成為歐盟首款獲得批准的仿製藥馬爾他聖瓜安, June 17, 2024 (GLOBE NEWSWIRE) -- Adalvo 宣布 Liraglutide 預充式注射筆成功取得 DCP 批准,成為歐盟首款獲得批准的仿製藥。 根據 IQVIA 的報2024-06-17
-
促进生育,助力三胎——“三胎免费生”联合公益行动正式启动为积极响应国家号召实施三胎生育政策,扩大妇幼服务健康供给,在云南省优生优育妇幼保健协会指导下,昆明广播电视台联合昆明安琪儿妇产医院,于6月13日在昆明广播2024-06-17
-
学党史传承红色精神 守党纪筑牢自律防线——平安养老险湖南分公司党支部开展主题党日活动七一前夕,平安养老险湖南分公司党支部全体成员走进“千年学府、百年师范”——湖南第一师范,开展了一次学史明理、学史增信、学史崇德、学史力行的主题党日活动。重2024-06-17