/* Stephen Maguire and Christine Comfort
    Friday Problem 9/9/2011
    COP 3223H Section 201
    Net Pay Calculator*/

#include <stdio.h>

int main (){

    //Create variables
    double pay_rate;
    double overtime_rate;
    int workweek;
    int total_hours;
    double pay;

    //Obtain input from the user
    printf("\n\nEnter the employee's pay rate ($/hr).\n");
    scanf("%lf", &pay_rate);

    printf("Enter the employee's overtime rate.\n");
    scanf("%lf", &overtime_rate);

    printf("Enter the employee's standard workweek (hrs.).\n");
    scanf("%d", &workweek);

    printf("Enter the number of hours the employee worked.\n");
    scanf("%d", &total_hours);

    //Include if statement to determine if overtime is necessary.
    //If hours worked is less than a regular workweek, then no overtime is needed.
    if (total_hours <= workweek){

        pay = total_hours * pay_rate;

        printf("The employee's gross pay is $%.2lf this week.\n\n", pay);
    }

    //If hours worked is over the regular workweek, then overtime must be calculated into pay.
    else {
        int overtime_hours;
        overtime_hours = total_hours - workweek;

        pay = (workweek * pay_rate) + (overtime_hours * (overtime_rate * pay_rate));
        printf("The employee's gross pay is $%.2lf this week.\n\n", pay);
    }


    //Include if statement to determine the level of taxation
    //The initial if is the untaxed braket, under $200.
    if (pay <= 200) {

        printf("After taxes, the employee's net pay is %.2lf this week.\n", pay);

    }

    //The second bracket taxes pay over $200 by 10%
    else if (pay <= 500) {

        double tax_cost;
        tax_cost = (pay - 200) * (.10);

        double pay_after_tax;
        pay_after_tax = pay - tax_cost;

        printf("After taxes, the employee's net pay is %.2lf this week.\n", pay_after_tax);

    }

    //The third bracket taxes pay over $500 by 20% then adds on additonal $30.
    else if (pay <= 1000) {

        double tax_cost;
        tax_cost = ((pay - 500) * (.20)) + 30;

        double pay_after_tax;
        pay_after_tax = pay - tax_cost;

        printf("After taxes, the employee's net pay is %.2lf this week.\n", pay_after_tax);

    }

    //The fourth bracket taxes pay over $1000 by 30% and then adds an additional $130.
    else {

        double tax_cost;
        tax_cost = ((pay - 1000) * (.30)) + 130;

        double pay_after_tax;
        pay_after_tax = pay - tax_cost;

        printf("After taxes, the employee's net pay is %.2lf this week.\n", pay_after_tax);

    }

    return 0;

}
