Difference between revisions of "CISC220 F2021 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)''...")
 
(1. C++ programming exercises)
 
(3 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
The ''Drozdek'' references below are to the textbook.  It shouldn't matter whether you have the 3rd or 4th edition.
 
The ''Drozdek'' references below are to the textbook.  It shouldn't matter whether you have the 3rd or 4th edition.
  
 +
<!--
 
===1. Written problems===
 
===1. Written problems===
  
 
* '''(0.5 points)''' Drozdek exercises 1.11.3 "Providing that the declaration..."
 
* '''(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 [https://developers.google.com/edu/c++/quiz 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.
 
* '''(1.5 points)''' Problem set 4, questions 1, 3, 5, 6, 7, and 9 (the "Cow" class) from Google for Education [https://developers.google.com/edu/c++/quiz 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.
 +
-->
 +
===1. C++ programming exercises===
  
===2. 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 [http://nameless.cis.udel.edu/class_data/220_f2014/code/functemplate.tar 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 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.
+
===2. Submission===
* '''(1 point)''' Download [http://nameless.cis.udel.edu/class_data/220_f2014/code/functemplate.tar 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.
 
* 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.).  
 
* 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 Thursday, September 11''
+
* Submit it in Canvas by ''midnight at the end of Tuesday, September 14''

Latest revision as of 14:55, 8 September 2021

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