Hey guys, I'm here once again! I need help for something that is simple, but I'm not getting the results I should be getting!
I want my output to look like this:
Enter hours worked: 44
Enter pay rates: 10
Hours worked: 44
Pay Rate: 10
This week's salary: 460
Enter an integer
7
In main: x = -7 and y = 0
Press any key to continue....
I know that seems a lot, but I got the code and everything working. I am having problems getting the number I want for "This week's salary which is 460" and " x = -7 and y = 0 ". If you guys can help me with this problem, I would appreciate it.
[LIST=1]
[*]#include <iostream>
[*]#include <iomanip>
[*]using namespace std;
[*]void getHoursRate (double& hours, double& rate);
[*]void printCheck (double hours,double rate,double& amount);
[*]void initialize (int& x,int& y,char& z);
[*]void funcOne (int& x,int& y);
[*]int main ()
[*]{
[*] int x = 0;
[*] int y = 0;
[*] char z;
[*] double rate, hours;
[*] double amount;
[*]
[*] getHoursRate(hours,rate);
[*] printCheck(hours,rate,amount);
[*] initialize (x,y,z);
[*] funcOne (x,y);
[*]
[*]
[*] system ("PAUSE");
[*] return 0;
[*]}
[*] void getHoursRate(double& hours,double& rate)
[*] {
[*] double amount;
[*] double perhour = 1.5;
[*]
[*] cout<<"Enter hours worked: "<<endl;
[*] cin>>hours;
[*] cout<<"Enter pay rate: "<<endl;
[*] cin>>rate;
[*]
[*] if (hours <= 40)
[*]
[*] amount = (hours * rate);
[*]
[*] else if (hours >= 40)
[*]
[*] amount = (hours * rate + perhour);
[*] }
[*]
[*]
[*] void printCheck(double hours,double rate,double& amount)
[*] {
[*] cout<<"Hours worked: "<<hours<<endl;
[*] cout<<"Pay Rate: "<<rate<<endl;
[*] cout<<"This week's salary: "<<amount<<endl;
[*] }
[*]
[*] void initialize (int& x,int& y,char& z)
[*] {
[*] int num;
[*] cout<<"Enter Integer"<<endl;
[*] cin>>num;
[*] }
[*]
[*] void funcOne(int& x,int& y)
[*] {
[*] cout<<"In main: x = "<<x<<" and y = "<<y<<endl;
[*] }
[/LIST]