# User Defined Classes homework

June 21, 2017
###### UMUC DMBA620 Break Even Assignment
June 21, 2017

User Defined Classes homework
Setup
Find and open the header file
~/lu06/7_assign_code/hw02/incl/fns02.h,
the function definition file
~/lu06/7_assign_code/hw02/src/fns02.cpp,
and the testing code file
~/lu06/7_assign_code/hw02/src/drvr02.cpp.
Problem Statement
A Betelgeusean plorg has these properties:
Data
A plorg has a name with no more than 19 letters.
A plorg has a contentment index (CI), which is an integer.
Operations
A new plorg starts out with a name and a CI of 50.
A plorg’s CI can change.
A plorg can report its name and CI.
The default plorg has the name “Plorga”.
Write a Plorg class declaration (including data members and member function prototypes) that represents a plorg. Write the function definitions for the member functions. Write short series of tests that demonstrate all the features of the Plorg class
Solving the Problem
Follow the guidelines presented in this Session to write the class declaration, then to define the member functions. Use the Class Diagram as your documentation tool for the design activities that lead to the class declaration. Follow the Design Recipe for the member functions and for the testing of the member functions.
Setup
Find and open the header file
~/lu06/7_assign_code/hw01/incl/fns01.h,
the function definition file
~/lu06/7_assign_code/hw01/src/fns01.cpp,
and the testing code file
~/lu06/7_assign_code/hw01/src/drvr01.cpp.
Problem Statement
Here’s a class declaration:
class Move
{ private:
double x_;
double y_;
public:
Move( double a = 0; double b = 0 ); // sets x_, y_ to a, b
void showmove() const; // shows current x_, y_ values
// add : Move –> Move
// to add x_ of input object to x_ of invoking object to get new x_,
// to add y_ of input object to y_ of invoking object to get new y_,
// to create new object initialized to new values and return it Move add( const Move &m ) const;
void reset( double a = 0, double b = 0 ); // resets x, y to a, b
};
Solving the Problem
Create member function definitions and a series of tests that exercise the class. Note that this class declaration does not have a full set of inspectors and mutators. That is OK for this exercise.
Both are considered one assignment.