#include <iostream>
#include <string>
using namespace std;
int main() {
char ans = 'Y';
while (ans == 'Y' || ans == 'y') {
std::cout << "\n";
std::cout << "[Enter game Information as followed]\n";
std::cout << "------------------------------------\n";
std::cout << "Duration of the game in minutes (between 40 and 90 and intervals of 10): ";
int game_duration = 0;
while (true) {
cin >> game_duration;
if (game_duration >= 40 && game_duration <= 90 && game_duration % 10 == 0) {
break;
}
else {
cout << "\nERROR: Your input for duration of the game is NOT valid. Please enter again. \n";
}
cout << " \nDuration of the game in minutes (between 40 and 90 and intervals of 10): ";
}
std::cout << "\n";
double price_per_min = 0;
double total_dollars = 0;
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
std::cout << "Enter Price per minute, choose between ($1.50 and $5.00): ";
while (true) {
cin >> price_per_min;
if (price_per_min >= 1.50 && price_per_min <= 5.00) {
break;
}
else {
cout << "\nInvalid input! Please enter a price between $1.50 and $5.00.\n";
}
cout << "Enter Price per minute, choose between ($1.50 and $5.00): ";
}
std::cout << "\n\nReferee Payment Breakdown...\n\n";
std::cout << "Game Duration: " << game_duration << " Minutes.\n";
std::cout << "Price per minute: $" << price_per_min << "\n";
double round_payment;
double payment = 0;
payment = (game_duration * price_per_min);
round_payment = static_cast<int>(payment + 0.5);
cout << "Total Payment: $" << round_payment << "\n";
int center_payment = (round_payment * 0.40);
int assistant_payment = (round_payment * 0.30);
int total_distributed = center_payment + 2 * assistant_payment;
int remaining = round_payment - total_distributed;
if (remaining >= 1) {
center_payment += 1;
remaining -= 1;
}
if (remaining >= 2) {
assistant_payment += 1;
assistant_payment += 1;
}
cout << "Center Ref's Payment: $" << center_payment << "\n";
cout << "Assistant Red's Payment: $" << assistant_payment << "\n";
std::cout << "\n";
cout << "Do Another Calculation?(Y/N): ";
cin >> ans;
}
cout << "Thank you for using the program!" << endl;
return 0;
}