CISC220 F2021 Lab2

From class_wiki
Jump to: navigation, search

Lab #2

The Drozdek references below are to the textbook. It shouldn't matter whether you have the 3rd or 4th edition.

1. C++ programming exercises

  • (3 points) Drozdek programming assignment 1.12.1: write a Fraction class with overloaded arithmetic and input/output operators. You may look up pseudocode for how to reduce factors. This class should be defined in Fraction.hh and Fraction.cpp in a fractions directory, and there should be test code in main() (in main.cpp) that shows all of its functionality.
  • (2 points) Download functemplate.tar, untar it, and make it a subdirectory of <Your Name>_Lab2 . Create a "templatized" function calculatesum() in main.cpp which has the same arguments and return type as findsmallest() in that file, but which adds every element of the array. Call this in example2() and example3() instead of findsmallest(). Modify the IntCell class as necessary to make this work.

2. Submission

  • Put a PDF file <Your Name>_README.pdf with your answers to the written exercises in <Your Name>_Lab2. This file should also contain a copy of the output of your Fraction class test program and the modified functemplate program. Credit your source for the reducing factors method and explain what changes you had to make to IntCell, if any.
  • Create a single tar/zip/rar file out of the top-level and all subdirectories. This archive file should be named <Your Last Name>_Lab2.tar (or .zip or .rar, etc.).
  • Submit it in Canvas by midnight at the end of Tuesday, September 14