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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
|
#include "stdafx.h"
#include <iostream>
#include <iomanip>
using namespace std;
//authorPay variables
float skillLvl, a, b, c, A, B, C;
float wordLength, payRate, payOut;
//authorPay2 Variables
int payments, totalPayments, paymentCounter;
float averagePayment;
int aClass, bClass, cClass;
int sentinel = 0;
// Function Prototypes
float PayOutTotal(float, float, float, float);
float payRateTotal(float, float);
int main() {
wordLength = 0;
payments = 0;
cout << " Welcome To Author Pay! " << endl;
while (wordLength != sentinel) {
totalPayments += payments;
paymentCounter++;
cout << "Please Enter The Word Length " << endl;
cin >> wordLength;
cout << endl;
cout << "Please Enter The Authors Skill Level (-1 To Quit) " << endl;
cin >> skillLvl;
cout << endl;
payRate = payRateTotal(wordLength, payRate);
payOut = PayOutTotal(payRate, wordLength, skillLvl, payOut);
}
cout << "Length of Story (Words) " << setw(8) << ' ' << "Amount To Be Paid " << endl;
cout << setw(12) << wordLength << setw(25) << ' ' << "$" << payOut << endl;
cout << " The Total Number of Payments Caluculated: " << totalPayments << endl;
cout << " The Average Amount Paid for a Story " << totalPayments / paymentCounter << endl;
cout << " The Total Number of Payments Caluculated: " << totalPayments << endl;
cout << " The Average Amount Paid for a Story " << totalPayments / paymentCounter << endl;
return 0;
}
//Function Definitions
float payRateTotal(float wordLength, float payRate)
{
payRate = 0;
if (wordLength < 7500) {
payRate = 0.08 * wordLength;
}
else if (wordLength > 7500 && wordLength < 8000) {
payRate = 600;
}
else if (wordLength > 8000 && wordLength < 17500) {
payRate = 0.075 * wordLength;
}
else if (wordLength > 17500 && wordLength < 19000) {
payRate = 1313;
}
else if (wordLength >= 19000) {
payRate = 0.07 * wordLength;
}
return payRate;
}
float PayOutTotal(float payRate, float wordLength, float skillLvl, float payOut) {
payOut = 0;
if (skillLvl == 'A' || skillLvl == 'a') {
payOut = payRate * 1.75;
}
else if (skillLvl == 'B' || skillLvl == 'b') {
payOut = payRate * 1.25;
}
else if (skillLvl == 'C' || skillLvl == 'c') {
payOut = payRate;
}
return payOut;
}
|