P10 SalesPerson Class Interface - 10 points (submit source code) |
|
The only thing required for this assignment is the class definition and an empty main function which is required by the compiler. The class definition created here will then be used to complete P11 SalesPerson Implementation.
UML - Class Diagram:
Symbol definitions:
- private
+ public
# protected
| SalesPerson |
|---|
|
- int salesPersonId - string firstName - string lastName |
|
+ SalesPerson ( ) //default constructor doesn't have parameters + SalesPerson(int id, string fn, string ln) //overloaded constructor; //parameter names in overloaded constructors should be different //from the class variable names, because the parameter values //are going to be assigned to the class variables. + ~SalesPerson ( ) //destructor //Set accessors do NOT return a value (void) because they are used //to assign a value to a private variable. The value to assign is //passed through the parameter. + void setSalesPersonId(int id) + void setFirstName(string fn) + void setLastName(string ln) //Get accessors are used to return the value stored in a private //variable, so a parameter is not passed. + int getSalesPersonId( ) + string getFirstName( ) + string getLastName( ) //Input accessors prompt for, get, and store a value in a private //variable. A value is not returned and a parameter is not passed. + void inputSalesPersonId( ) + void inputFirstName( ) + void inputLastName( ) |
Create project P10
Add a C++ Source file named P10.cpp
Enter your class definition for SalesPerson
Make sure there aren't any syntax errors in the class definition.
An empty main function will need to be added so the project will compile.
Sample Source Code:
//P10 SalesPerson class - Juan Marquez
#include <string> // string class
using namespace std;
//Class definition - the interface for the class
class SalesPerson
{
private:
public:
};
//Need empty main so program will compile
void main()
{
return;
}