Main Page   Packages   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

SalesPerson Class Reference

#include <SalesPerson.hpp>

List of all members.

Public Methods

 SalesPerson ()
void getSalesFromUser ()
void setSales (int, double)
void printAnnualSales ()

Private Methods

double totalAnnualSales ()

Private Attributes

double sales [12]


Constructor & Destructor Documentation

SalesPerson::SalesPerson  
 

Definition at line 7 of file SalesPerson.cpp.

00007                          {
00008    for ( int i = 0; i < 12; i++ )
00009       sales[ i ] = 0.0;
00010 }


Member Function Documentation

void SalesPerson::getSalesFromUser  
 

Definition at line 13 of file SalesPerson.cpp.

00014 {
00015    double salesFigure; 
00016 
00017    for ( int i = 0; i < 12; i++ ) {
00018       cout << "Enter sales amount for month " << i + 1 << ": ";
00019       cin >> salesFigure;
00020       setSales( i, salesFigure );
00021    }
00022 }

void SalesPerson::printAnnualSales  
 

Definition at line 36 of file SalesPerson.cpp.

00037 {
00038    cout << setprecision( 2 )
00039         << setiosflags( ios::fixed | ios::showpoint )
00040         << "\nThe total annual sales are: $"
00041         << totalAnnualSales() << endl;
00042 }

void SalesPerson::setSales int    month,
double    amount
 

Definition at line 26 of file SalesPerson.cpp.

Referenced by getSalesFromUser().

00027 {
00028    if ( month >= 0 && month < 12 && amount > 0 ) {
00029       sales[ month ] = amount;
00030    } else {
00031       cout << "Invalid month or sales figure\n";
00032    }
00033 }

double SalesPerson::totalAnnualSales   [private]
 

Definition at line 45 of file SalesPerson.cpp.

Referenced by printAnnualSales().

00046 {
00047    double total = 0.0;
00048 
00049    for ( int i = 0; i < 12; i++ )
00050       total += sales[ i ];
00051 
00052    return total;
00053 }


Member Data Documentation

double SalesPerson::sales[ 12 ] [private]
 

Definition at line 19 of file SalesPerson.hpp.


The documentation for this class was generated from the following files:
Generated on Sun Oct 14 18:49:36 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001