Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

NAME: James Fritz M.

Dedase SR-CODE: 22-06913

SECTION: CpE-2105. DATE: November 14,,2023

A. PSEUDOCODE

Display "=== Welcome to the Payroll Program! ==="


Call func()
Display "=== Thank you for using the Payroll Program! ==="
Repeat:
Display "Enter hourly pay rate (Php 40.00 - Php 250.00):"
Try:
Read hourly_pay_rate as float
If 40.00 <= hourly_pay_rate <= 250.00:
Return hourly_pay_rate
Else:
Display "Invalid input. Pay rate must be in the range of Php 40.00 through Php
250.00."
Except ValueError:
Display "Invalid input. Please enter a valid number."

Repeat:
Display "Enter hours worked (0 - 48):"
Try:
Read hours_worked as float
If 0 <= hours_worked <= 48:
Return hours_worked
Else:
Display "Invalid input. Hours worked must be in the range of 0 through 48."
Except ValueError:
Display "Invalid input. Please enter a valid number."

Function compute_gross_pay():
hourly_pay_rate = Call get_hourly_pay_rate()
hours_worked = Call get_hours_worked()
gross_pay = hourly_pay_rate * hours_worked
Display "Employee's Gross Pay: Php " + Format(gross_pay, '.2f')

Call compute_gross_pay()
B. FLOWCHART
C. PROGRAM

def welcome_decorator(func):
def wrapper():
print("=== Welcome to the Payroll Program! ===")
func()
print("=== Thank you for using the Payroll Program! ===")
return wrapper

def get_hourly_pay_rate():
while True:
try:
hourly_pay_rate = float(input("Enter hourly pay rate (Php 40.00 - Php 250.00): "))
if 40.00 <= hourly_pay_rate <= 250.00:
return hourly_pay_rate
else:
print("Invalid input. Pay rate must be in the range of Php 40.00 through Php
250.00.")
except ValueError:
print("Invalid input. Please enter a valid number.")

def get_hours_worked():
while True:
try:
hours_worked = float(input("Enter hours worked (0 - 48): "))
if 0 <= hours_worked <= 48:
return hours_worked
else:
print("Invalid input. Hours worked must be in the range of 0 through 48.")
except ValueError:
print("Invalid input. Please enter a valid number.")

def compute_gross_pay():
hourly_pay_rate = get_hourly_pay_rate()
hours_worked = get_hours_worked()
gross_pay = hourly_pay_rate * hours_worked
print(f"\nEmployee's Gross Pay: Php {gross_pay:.2f}")

compute_gross_pay()

You might also like