C Passing Arguments to Constructors I need help The pay of

C++ : Passing Arguments to Constructors: I need help!

The pay of an hourly worker is calculated by multiplying the hours worked by the hourly rate—up to 40 hours; any hours worked beyond 40 are paid at time-and-a-half (one and a half times the hourly rate). Given the variables hours, rate, and pay have already been declared and assigned  values , write a fragment of code (one or more statements ) that assigns to pay the proper value , taking into account time-and-a-half. (basic arithmetic, basic conditional )

Solution

Given variables are: hours, rate, pay.

Fragment of code (one or more statements ) that assigns to pay the proper value , taking into account time-and-a-half.

pay = hours * rate;

if(hours > 40)

pay += (hours - 40) * rate * 0.5;

C++ : Passing Arguments to Constructors: I need help! The pay of an hourly worker is calculated by multiplying the hours worked by the hourly rate—up to 40 hour

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site