
/* hw4p1 */


#include <stdio.h>
#include "simpio.h"
#include "genlib.h"

double ComputePay(double wage, double hours, bool weekday);

void main()
{
  double wage, hours;
  bool weekday;

  /* prompt for user input */
  printf("What is our hourly wage? ");
  wage = GetReal();
  printf("How many hours did you work? ");
  hours = GetReal();
  printf("Is today a weekday (y/n)? ");
  if (getchar() == 'y')
    weekday = TRUE;
  else
    weekday = FALSE;
  getchar();  /* eat newline character */
  printf("You have made $%.2f today!\n", ComputePay(wage, hours, weekday));
}

double ComputePay(double wage, double hours, bool weekday)
{
  if (weekday)
    return wage * hours;
  else
    return wage * hours * 1.5;
}
