LAB #1 Solution

$30.00

Category:

Description

  • Create a simple C++ program to instantiate an object that will store two numbers and perform mathematical operations using those numbers as operands. The class should have a header called Adder.h and a .cpp file called Adder.cpp. Testing should be done in a separate .cpp file called main.cpp. The class should have at least two constructors. The default constructor should instantiate both operands to 2. A second constructor should accept two numbers as arguments and use the arguments to set the local operands. The class should have 6 functions: add(), subtract(), multiply(), divide(), get(), and set(). The first four functions should return the result of performing the stated operations using the two operands and take no arguments. Get() should take one argument to specify which operand to return. Set() should take two arguments, the first to specify which operand to set and the second to specify the number to set the operand equal to. Your code should document each function, and the class, with comments.

error: Content is protected !!