- 1
Write a program to calculate hourly wages for which there are two choice given in the description.
For regular time(upto 40 hours) gross pay=rate*hours For over time gross pay=rate*40+1.5*rate*(hours-40);
4 Réponses
+ 1
your description breaks down what the program needs. put it together
+ 1
I won't do your homework for you, but thanks for the idea. Now I have a new Python program that tells me how much I make on any given week. This is what I did. maybe it will lead you to a solution to your problem
running=1
while running:
print("\n"*3)
hours=int(input("Hours?" ))
pay=28.71
gross=0
otpay=(pay/2)+pay
othours=hours-40
straight=pay*(hours-othours)
hours=hours-othours
gross=hours*pay
if othours>0:
gross+=othours*otpay
print("quot;, end='')
print("%.2f" % gross)
+ 1
I tried it myself🙋 and after putting in some effort I was able to do it myself
👦✌
#include <iostream>
using namespace std;
int main ()
{
float rate,hours,gp;
cout <<"Enter the rate:"<<endl;
cin>>rate;
cout <<"Enter the hours:"<<endl;
cin>>hours;
if (hours<=40)
gp=rate*hours;
else
rate=rate*40+1.5*rate*(hours-40);
cout <<"The gross pay is "<<gp <<endl;
return 0;
}
0
I knew ya could do it. good job!