1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
#include "Employee.h"
#include <iostream>
#include <fstream>
#include<string>
using std::ofstream;
using std::ios;
using namespace std;
int printCheck(const Employee& newObj)
{
cout << "\n----------FluffShuffle Electronics----------";
cout << "\n\nPay to the order of " << newObj.getName() << ".............$" << newObj.calcPay() << endl;
cout << "\nUnited Bank of Eastern Orem\n--------------------\n\nHours worked: " << newObj.getHoursWorked();
cout << "\nHourly wage: " << newObj.getHourlyWage() << endl;
return 0;
}
int main()
{
cout.setf(ios::fixed); //formatting our doubles
cout.setf(ios::showpoint);
cout.precision(2);
string nameOne = "Joe Brown", nameTwo = "Sam Jones", nameThree = "Mary Smith", addressOne = "123 Main St.", addressTwo = "45 East State", addressThree = "12 High Street", phoneOne = "123-6788", phoneTwo = "661-9000", phoneThree = "401-8900"; //our object values
const int AGE_ONE = 45, AGE_TWO = 30, AGE_THREE = 40, EMP_ONE= 37, EMP_TWO=21, EMP_THREE=15;
const double RATE_ONE = 10.00, RATE_TWO = 12.00, RATE_THREE = 15.00;
int optionOne = 1,optionTwo = 2; //menu variables
int choice;
string bufferFlush = "";
/* Presents the user with a menu of choices:
-create a data file, or read data from a file and print checks.*/
cout << "\nThis program has two options:\n1 - Create a data frile, or\n2 - Read data from a file and print paychecks.\nPlease enter (1) to create a file or (2) to print checks:\t";
while (!(cin >> choice)){
cin.clear();
cout << "\nInvalid input occured."; // output error message
cin >> bufferFlush; //get string out of cin
cout << "\nPlease enter a valid option, either 1 or 2: ";
}
if (choice == One){
Employee joe(EMP_ONE, nameOne, addressOne,phoneOne,AGE_ONE,RATE_ONE);//Create three employee objects
Employee sam(EMP_TWO, nameTwo, addressTwo, phoneTwo, AGE_TWO, RATE_TWO);
Employee mary(EMP_ONE, nameThree, addressThree, phoneThree, AGE_THREE, RATE_THREE);
ofstream myOutputStream("mydata.txt");//Create an ofstream and opoen a file.
}
else if (choice == optionTwo){
}
system("PAUSE");
return 0;
}
|