MTRX3760 - Lab 2 Inheritance and PolymorphismC/C++

Java Python MTRX3760 - Lab 2

Inheritance and Polymorphism

2024.Aug.09

This assignment contributes 10% towards your final mark. It is to be completed individually, not in groups. Total Marks: 100.

This assignment is due before the start of your allocated lab session in two weeks, i.e. before the start of the Week 4 lab session for Weds/Fri labs, and before the start of the Week 5 lab session for Monday labs. Late assignments will be subjected to the University’s late submission policy unless accompanied by a valid special consideration form. Plagiarism will be dealt within accordance with the University of Sydney plagiarism policy. Lab submissions will not be accepted more than a week after the due date.

Assignments will be assessed based on the following components. Incomplete submissions will have severely reduced marks:

Report: Submit a .pdf report using the class Canvas site. The report can be very simple, and needs only directly address the questions laid out in the assignment.

The cover page for your report should include your SID and tutorial section, but do not include your name to comply with the University’s anonymous marking policy.

Code appendix: The appendix ofyour report must contain a printout (in text format) of all source code written for the assignment. File header comments and proper formatting will be  critical to making this section readable. Unintelligible code attachments will result in loss of marks.

Code: Submit your code (code only, no binaries) in a .zip file via the canvas site.

Please see Lab 1 for hints on preparing your report, including how to format code for inclusion in the appendix.

Polymorphic Combinatorial Logic Simulator

This lab should be completed with concepts taught in lectures from Weeks 1 and 2.

The logic simulator from Lab 1 was limited to simulating NAND gates. In this example you will apply your knowledge of inheritance and polymorphism to redesign that program. You may start from the code you produced in Lab 1, or redo the program from scratch.

For this assignment all code should follow the coding practices and concepts covered in the Week 1 and 2 lectures, including coding style. and use of constructors / destructors.

Make the following changes to the program:

A.  Add the capability to simulate AND, OR, and XOR gates.

B.  Add the capability to instantiate and simulate sub-circuits. A half-adder and the 1-bit comparator shown below are examples of sub-circuits. [2024 Aug 09: circuit corrected]

[https://www.geeksforgeeks.org/magnitude-comparator-in-digital-logic/]

C.   Simulate a two-bit comparator that accepts two 2-bit binary inputs, and generates three outputs, one for each case of equal, less than, or greater than. Your 2-bit comparator should be constructed from 1-bit comparator sub-circuits and a few additional logic gates.

MTRX3760 - Lab 2 Inheritance and PolymorphismC/C++

Hints / Simplifications:

●   As in Lab 1 it is acceptable for circuit construction to be hard-coded, but think carefully about where this occurs.

● As in Lab 1 you do not need to split the program (source code) into multiple files.

●   Think back to MTRX1705 to derive the circuit for a 2-bit comparator built from two 1-bit comparators like the one shown above.

●   Work incrementally. Proceed through the steps A-C above one at a time, testing your program at each stage. Do give some thought, in Step A, how you might achieve Step C.

●   Refer back to the checklist provided with Lab 1. Included below is a coding style guideline based on best practices described in lecture.

[20 Marks] Functionality: In your report show the output of your program demonstrating correct operation of the circuit. Think about how you will test your circuit and demonstrate that it is working correctly. Program output should be copy/pasted into your report, not displayed as a screenshot. Your report and the code in your attached .zip file will be assessed for correct functionality.

[30 Marks] Code Quality: Your code will be assessed based on style and coding best practices as taught in lecture.

[50 Marks] Design: In your report provide a complete UML class diagram for your design, including significant member variables and functions. This diagram and your code will be assessed based on appropriate use of the design principles taught in lecture.

Self-Assessment

[+5 Bonus] In your report estimate the level of achievement ofyour submission. Show estimates for all component grades as well as the total. If your estimated total is within 5 marks of the correct score you will be awarded 5 bonus marks. Ignore late penalties when estimating.

/20 Functionality

/30 Code quality

/50 Design

/100 Total

Coding Style Guideline

This is a summary of specific advice given in lectures, but be mindful that you are making many more decisions than these about how to write your code, e.g. how you choose to name your variables, in what case, etc. Throughout the lectures we have emphasised consistency: the code you submit should use the same style. throughout.

Lec 1B

1.   Informative naming

2.   Consistent, defensive bracing; one statement per line

3.   Consistent indentation, spacing, bracing

4.   Readable variable declarations, one variable per line

5.   Avoid #defines, they hide bugs well; use consts instead

6.   Shape comments & whitespace to highlight structure

Lec 2A, 2B

1.   Emphasise parallel structures to help spot bugs

2.   Avoid repeating code: fewer bugs, less code to maintain

3.   Avoid multiple exits, these make it harder to debug with breakpoints, couts

ROS Tutorials

Complete the ROS 2 tutorials here: https://docs.ros.org/en/humble/Tutorials.html . With your current knowledge, you can complete the Beginner: CLI tools sections. By the end ofLab 3, you must have completed up to and including the Beginner: Client Libraries sections. Be sure to complete the C++ versions of the tutorials         

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值