Question: C++ problems * Add constructors - a default and parameterized constructor to each. * Write an .h interface and a .cpp implementation for each class
C++ problems
* Add constructors - a default and parameterized constructor to each.
* Write an .h interface and a .cpp implementation for each class
* Write an Drive/Test file that tests the constructors and functions
* Write a UML class diagram for each class
Q. 1
#include
#include
using namespace std;
// STEP 1 - DEFINE THE new datatype/Class 'aThing'
class aThing {
public:
double getWeight(void) { return weight; }
void setWeight( double inWeight ) { weight = inWeight; }
private:
double weight;
};
int main()
aThing ThingOne;
ThingOne.setWeight(110);
cout << "Use Function/Method get Weight - "<< "Weight is: " << ThingOne.getWeight() << endl;
system("PAUSE");
return 0;
}
-----------------------------------------------------
Q.2
#include
using namespace std;
class BuckyClass {
public:
void coolSaying() {
cout << "preachin to the choir" << endl;
}
};
int main ()
{ BuckyClass buckyObject;
buckyObject. coolSaying();
return 0;
}
--------------------------------------------
Please help me with these questions. Thanks
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
