68.4k views
1 vote
I don't know who to do this assignment

An employee’s total weekly pay equals the hourly wage multiplied by the total number of regular hours plus any overtime pay. Overtime pay equals the total overtime hours multiplied by 1.5 times the hourly wage. Write a program that takes as inputs the hourly wage, total regular hours, and total overtime hours and displays an employee’s total weekly pay.

1 Answer

4 votes

Python:

wage=int(input("What the hourly wage?: "))

total_reg_hours=int(input("Enter total regular hours: "))

total_over_hours=int(input("Enter total overtime hours: "))

#Calculate the weekly pay.

print("The weekly pay of this employee is ",(total_reg_hours*wage)+(total_over_hours*(1.5*wage)))

C++:

#include <iostream>

int main(int argc, char* argv[]) {

int wage,t_reg,t_over;

std::cout << "Enter wage: "; std::cin>>wage;

std::cout << "\\Enter total regular hours: "; std::cin>>t_reg;

std::cout << "\\Enter total overtime hours: "; std::cin>>t_over;

//Calculate the weekly pay.

std::cout << "The weekly pay of this employee is " << (t_reg*wage)+(t_over*1.5*wage) << std::endl;

return 0;

}

User Orfdorf
by
7.5k points