首页 > > 详细

辅导 program程序、讲解 c++,Python编程

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
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!