// This program demonstrates overloaded functions to calculate the gross weekly pay of hourly-wage or salaried employees.

#include <iostream>
#include <iomanip>
#include "getChoice.h"
#include "calcWeeklyPay.h"

using namespace std;

int main() {
  
  // Define variables
  char menuSelection; // Menu selection
  int hoursWorked; // Weekly hours worked
  double hourlyRate; // Hourly pay rate
  double annualSalary; // Annual salary
  double weeklyPay; // Weekly pay to be calculated
  
  // Set numeric output formatting
  cout << fixed << showpoint << setprecision(2);
	
  // Menu output
  cout << "Do you want to calculate the weekly pay of (H) an hourly-wage employee, or (S) a salaried employee?" << endl;

  // Input menu selection with validation
  getChoice(menuSelection);

  // Process menu selection with switch statement
  switch (menuSelection) {
    case 'H':
      cout << "How many hours did the employee work in a week? ";
      cin >> hoursWorked;
      cout << "What's the hourly rate? $";
      cin >> hourlyRate;
      weeklyPay = calcWeeklyPay(hoursWorked, hourlyRate);
      cout << "Their weekly pay is: $" << weeklyPay << endl;
      break;
    case 'S':
      cout << "What's the employee's annual salary? $";
      cin >> annualSalary;
      weeklyPay = calcWeeklyPay(annualSalary);
      cout << "Their weekly pay is: $" << weeklyPay << endl;
      break;
  }

  return 0;

}