Monday, January 14, 2013

PROJECT 1: Calculator

For this project, you will create a program that performs a calculation.

Read the Style Guide before beginning this project.

Due January 31st, 2012 by 11:59PM

Minimum Requirements:

  • I will return your work and ask you to resubmit if the Required Comments from the style guide are missing.
  • Download the calculate.h header file and use it (including all member functions and member variables that are currently defined) as part of your implementation. You will need to add to this class, but you should not change the existing code in this header file without my permission. 5 points.
  • Create a function for the calculate class that will take in two numbers using cin and add them together (use private class variables for this!). For an extra challenge, create more than one function for this: one function to take in the numbers and another to do the calculation. 5 points
  • Create a function to display the results of the calculation by displaying the contents of a private class variable that holds the calculation results. 5 points
  • Create a main function that will declare an object of the calculate class and use all of the functions of that class. Save the main function code in a separate .cpp file. Remember the #include line to include your class header file. 5 points

    Note: There are many websites that will give you c++ code to create a calculator (I am very familiar with many of them) and you are welcome to use them as examples, but you must use my calculate class, create and use private functions for this class and store your data in private class variables or you will lose significant points. Keep in mind that most example code on the Internet will not do this, so if you do borrow code, you will have to modify it to meet my requirements. Also, remember to document any websites you referenced in the attribution section of your required comments!

    Optional Challenge:

    In addition to meeting the minimum requirements (they are still required even if you elect to do more), you can go beyond the requirements and create a more complex calculator with as many operations as you'd like. Make sure to separate each operation into its own separate function. Because you will be using private class variables, you will need to be very careful of how those variables are used when you have more than one function accessing them!