Difference between revisions of "CISC220 F2014 Lab2"

From class_wiki
Jump to: navigation, search
(Created page with "==Lab #2== The ''Drozdek'' references below are to the textbook. It shouldn't matter whether you have the 3rd or 4th edition. ===1. Written problems=== * '''(0.5 points)''...")
(No difference)

Revision as of 10:27, 18 January 2017

Lab #2

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

1. Written problems

  • (0.5 points) Drozdek exercises 1.11.3 "Providing that the declaration..."
  • (1.5 points) Problem set 4, questions 1, 3, 5, 6, 7, and 9 (the "Cow" class) from Google for Education quiz on classes. You are on your honor to not look up the linked answers or actually compile and run the code. Take some time to look at the code and think about what it is doing.

2. C++ programming exercises

  • (2 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 main.cpp in a fractions directory, and there should be test code in main() that shows all of its functionality.
  • (1 point) 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.

3. 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 Sakai by midnight at the end of Thursday, September 11