程序代写代做代考 computer architecture assembly data structure compiler Introduction to Computer Architecture Polymorphism

Introduction to Computer Architecture Polymorphism

For this assignment, you will create a series of classes representing shapes. While the inheritance

part of polymorphism happens at the compiler/programmer level, we can still explore how to implement

the dynamic function calls that attend polymorphism. For this assignment, you will implement a series of

11 simple classes representing two- and three-dimensional shapes.

Two-Dimensional Three-Dimensional
Rectangle Box
Square Cube
Triangle Pyramid
Circle Sphere
Cylinder

Each class should support a handful of functions, print_name(), area() or volume(), a constructor

and getters and setters for publically accessible variables. Since the super classes are mostly abstract, they

will only have the print_name function. For the other classes, you will want to minimize the number of

functions you write by using inheritance.

You should not need to modify the test suite. You only need to write your functions. Since QT

SPIM expects all of your code to be in a single file, you can concatenate them together in a few ways. If

you are on Windows, you can use the included batch file to do the work for you. Simply dragging your

source file and dropping it on the batch file should be sufficient. If you are having trouble with the batch

file, make sure that your file names match those below. You can also use a command line operation.

Windows: copy /Y “”+”Test Suite.asm” Output.asm

Unix: cat “” “Test Suite.asm” > Output.asm

Your program should include appropriate comments indicating what the code should be doing and

what registers are being used for. After displaying the results, your program should exit cleanly. You should

test your programs using the SPIM simulator to ensure their functionality before submitting them. You

should only submit your functions. You will not receive credit if you submit the test suite in any form. You

should also not include any driver or debug code in your submission.

Objectives:

1. To implement polymorphism in assembly language.

2. To review data structures.

3. To review function pointers.