Program: Weekly Pay Calculation

Instructions

In this programming assignment, you are tasked with creating a C program that calculates the weekly pay of an employee. The program should prompt the user to input the number of hours worked in a week via the keyboard. The output should display the gross pay, taxes, and net pay. Assumptions for the calculations are as follows:

  • Basic pay rate: $12.00 per hour.

  • Overtime (in excess of 40 hours): Time and a half.

  • Tax rates:

    • 15% of the first $300.

    • 20% of the next $150.

    • 25% of the rest.

Your goal is to implement this program in C and provide a clear, well-documented solution.

Algorithm

  1. Input:

    • Prompt the user to enter the number of hours worked in a week.

  2. Calculate Gross Pay:

    • If the hours worked are less than or equal to 40, calculate the gross pay using the basic pay rate.

    • If the hours worked exceed 40, calculate the gross pay with time and a half for overtime.

  3. Calculate Taxes:

    • Determine the tax amount based on different income thresholds and tax rates.

  4. Calculate Net Pay:

    • Subtract the calculated taxes from the gross pay to obtain the net pay.

  5. Output:

    • Display the Weekly Payroll Summary, including Gross Pay, Taxes, and Net Pay.

Pseudocode

Program

This C program calculates weekly pay based on the provided requirements and displays the results in a structured format.