Download as rtf, pdf, or txt
Download as rtf, pdf, or txt
You are on page 1of 7

/******************************************************

* Program: Project 3 *

* Author : Carlos Quinones *

* Class : CPT 234 *

* Purpose: Calculate a salesperson's pay based on *

* total sales. *

******************************************************/

#include <iostream.h>

#include <stdlib.h>

#include <stdio.h>

void MainMenu();

int GetCount();

void ProcessSales();

double GetSalesData();

double SalesGT500(double WeeklySales);

double SalesLT500(double WeeklySales);

double DisplayPay(double Commision);

void MainMenu()

system ("cls");

cout << "**************************[ Welcome To ABC Company ]


**************************\n"
<< "* Payroll By: Carlos Quinones *\n"

<<
"******************************************************************************
\n\n";

GetCount()

int Count;

int GreaterThen1; // <---------- To make sure that they enter the rite amount!!

cout << "How many sales people: ";

cin >> Count; // <-------- this is how many Sales people they have.

do

if (Count >= 1) // This is the way to make sure

{ // they enter a real number of

return Count; // sales people. and if they do

GreaterThen1 = 0; // not they have to do it again!

else

cout << "Sorry Please Enter A Ral Number!\n\n";

}
}while (GreaterThen1 == 1);

void ProcessSales()

int Count;

int Counter = 0; // This function is the heart of

int UID; // this program it is what everything

double WeeklySales; // is tyed into. if there is an error

double Commision; // in this please e-mail me at

double Pay; // CarlosQu17@hotmail.com and the subject

char FirstName[32]; // should be

char LastName[32]; // Error in ProccessSales()

Count = GetCount();

do

cout << "Please Enter Sales Person Name (First & Last): ";

cin >> FirstName >> LastName;

cout << "Please Enter Sales ID: ";

cin >> UID; // This is the loop that asks these questions

WeeklySales = GetSalesData(); // until we have finished with the amount


of

// sales people we have.


if (WeeklySales >= 500)

Commision = SalesGT500(WeeklySales);

Pay = DisplayPay(Commision);

else

Commision = SalesLT500(WeeklySales);

Pay = DisplayPay(Commision);

system ("cls");

MainMenu();

cout << "Sales Person: " << FirstName << " " << LastName << "\n"

<< "Sales ID : " << UID << "\n"

<< "Weekly Sales: " << WeeklySales << "\n"

<< "Commision : " << Commision << "\n"

<< "Pay : " << Pay << "\n\n"

<<
"******************************************************************************
\n\n\n\n\n";

Counter++;

}while (Counter < Count);


}

double GetSalesData()

/* int UID; */ // This function lets you enter the Sales

double WeeklySales; // Data. The Enter sales id thing does

/* // not work i had to do it for my project

cout << "Please Enter Sales ID: "; // so please dont e-mail me telling me it

cin >> UID; // is pointless I know this you know this and

*/ // my whole class and teacher knows this.

cout << "Please Enter Weekly Sales: "; // Any other errors with this function feel

cin >> WeeklySales; // free to e-mail me at CarlosQu17@hotmail.com

// subject of the e-mail should be

return WeeklySales; // Error In GetSalesData()

double SalesGT500(double WeeklySales)

double Commision; // This function will get the commision for the

double First500; // sales person who has more then 500 dollars in

double Over500; // weekly sales. I am not the best when it comes

// to math so if there is a better way to get the

Over500 = (WeeklySales - 500) * .15; // answer let me know by e-mailing me and if any

First500 = 500 * .10; // errors please e-mail me also at


CarlosQu17@hotmail.com

// subject of the e-mail should be


Commision = First500 + Over500; // Error in SalesGT500 - for error

return Commision; // Sugestion about SalesGT500 - for a comment

double SalesLT500(double WeeklySales)

double Commision; // This function will get the commision for the

// sales person who did not make the 500 dollars

Commision = WeeklySales * .10; // in weekly sales.

return Commision; // If you get an error please email me at


CarlosQu17@hotmail.com

// subject of the e-mail should be

// Error In SalesLT500()

double DisplayPay(double Commision)

double pay; // This function just adds 300 the base salary of

// our sales men/women. There is no way that there

pay = Commision + 300; // is an error in this but if there is just drop

return pay; // me an e-mail at CarlosQu17@hotmail.com the subject

// should be 'Error in DisplayPay().

void main ()

{
ProcessSales();

// Any sugustions on this application please e-mail me at CarlosQu17@hotmail.com with the


subject

// Sugsustions for CPT234P3.cpp. this is very important if i do not know you i will not open

// your e-mail so if i don't see this or any of the above in the subject then i will not open

// it so i wont be able to help you. ~Carlos Quinones

You might also like