首页 > 科技
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
- 搜索
-
- 06-26荣联科技集团出席华为四川新质生产力城市峰会
- 06-26Instagram群发推广软件,ins高效引流助手,ig全自动采集,ins协议号批量出售
- 06-26大运重卡经销商内蒙古豪烈公司盛大开业暨大客户交车仪式隆重举行
- 06-26探索钢结构行业新纪元,钢结构信息平台引领未来
- 06-26首届Style3D伙伴大会,与300+行业精英“乘风破浪”
- 06-26WhatsApp稳定批量群发 跨境电商的新选择
- 06-26WhatsApp高效批量群发 WS私信操作全攻略
- 06-26WhatsApp群发营销获客 跨境电商的得力助手
- 06-26WhatsApp高效批量群发 WS协议号全攻略
- 06-26WhatsApp群发营销新玩法 WS直登号详解
- 标签列表