need some help here.

i was doing this homework for class. Is to create a program that will tell you how much you get paid, given the amount of hours and the amount of money you get paid for each hour. but thin it got harder when i wanted to add the overtime paid. this is what i have so far. i need some tips. thanks


// This program will calculate how much do we get pay for hour, overtime .


#include <iostream>
#include <stdlib.h>
#include <string>

int main ()

{
//variables
float HD; // hours pay.
float HAD; // hours a day.
float total; // total of hours pay times hours.
float OTH; // Over TimeHours.
float OTP; // Over Time Paid.
float OTtotal; // Over Time Total Paid
// hourly pay
cout << "Plese enter how much do you get pay for hour: ";
cin >> HD;
cout << "Please enter how many hours you do a day: ";
cin >> HAD;
cout << "Please enter how much do you get pay for OverTime: ";
cin >> OTP;
cout >> "Please enter how many hours of OverTime you did: ";
cin >> OTH;

//multiply hours a day * hours pay.
total = HD * HAD;
// Over Time paid is: OTP = HP/2 + HP * OTH
OTtotal = OTP = HP/2 + HP * OTH;


//display the result
cout << " The total amount of money that you get paid by hours is = " << total << ;
cout << " The total amount of money that you get paid of OverTime is = " << OTtotal << endl;

system("pause");
}
Last edited on
closed account (L1T0RXSz)
Hi,
Is this what you want? I doubt it but try it out.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <iostream.h>
#include <stdlib.h>
#include <string.h>

int main()

{
        //variables
        float HP;
        float HD; // hours pay.
        float HAD; // hours a day.
        float total; // total of hours pay times hours.
        float OTH; // Over TimeHours.
        float OTP; // Over Time Paid.
        float OTtotal; // Over Time Total Paid
        // hourly pay
        cout << "Plese enter how much do you get pay per hour: ";
        cin >> HD;
        cout << "Please enter how many hours you work a day: ";
        cin >> HAD;
        cout << "Please enter how much you get payed for OverTime: ";
        cin >> OTP;
        cout << "Please enter how many hours of OverTime you worked: ";
        cin >> OTH;

        //multiply hours a day * hours pay.
        total = HD * HAD;
        // Over Time paid is: OTP = HP/2 + HP * OTH
        OTtotal = OTP * HD;


        //display the result
        cout << " The total amount of money that you get paid by hours is = " << total;
        cout << " The total amount of money that you get paid for OverTime is = " << OTtotal << endl;

        system("pause");
        }

I also added some changes to the text (grammar). You can change it back.
Last edited on
Topic archived. No new replies allowed.