I am having a little trouble with my program assignment. I don't want the answer I just need pointed in the wrtie direction.
I cannot get my program to loop. The program prompts user to enter hours worked and calculates and displays. The it asks the user to enter y for yes to continue entering more data. I get to there and then it stops. Below is my code that I have written. Can anyone give me suggestions? Thanks
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
void weeklySalary();
double wage;
int hours = 0;
double overtime = 10;
const int per_wk = 40;
double regpay = 0;
double doubletime = 0;
double overtimepay = 0;
char y;
char response;
int main()
{
weeklySalary();
cout << "\n\nIs there more data to enter? Select y to resume.\n";
cin >> response;
if(response == 'y' || response == 'Y')
{
cout << weeklySalary << endl;
}
else
cout << "Ending Program. " << endl;
return 0;
}
void weeklySalary()
{
cout << "Enter number of hours worked for the week. \n";
cin >> hours;
cout << "Enter hourly wage: \n";
cin >> wage;
regpay = per_wk * wage;
overtime = hours - per_wk;
if (overtime <=10)
{
overtimepay = overtime * 1.5 * 10.00;
doubletime = 0;
}
else
if (overtime >10)
{
overtime = hours - per_wk;
overtimepay = 10 * 1.5 * 10.00;
doubletime = overtime - 10;
doubletime = doubletime * 2 * 10.00;
}
else;
cout << "\n\nRegular Pay: $" << regpay << endl;
cout << "Time-and-a-half: $" << overtimepay << endl;
cout << "Double Time: $" << doubletime << endl;
cout << "Total: $" << regpay + overtimepay + doubletime << endl;
}
<< moderator edit: added code tags: [code][/code] >>