I know this shouldn't be so hard but I'm having a hard time just getting 2 DOUBLE variables to multiply! I don't know what I'm doing wrong, and yes, it's for a school project... but getting 2 double variables to multiply isn't the point of the project. Any suggestions? Thanks!
The problem is at the end of the code.
#include <iostream>
#include <string>
using namespace std;
const double fedWithholdingRate = 0.18;
const double stateWhithholdingRate=0.045;
const double HospDed = 25.65;
const double UnionDues = 0.02;
string employee;
double
hoursWorked = 0,
hourlyWage = 0,
totalWage = 0,
fedWitholdingAmt = 0,
stateWithholdingAmt = 0,
totDeductions = 0,
netPay = 0;
int main()
{
//Gather the employee intiials, hours worked, and hourly rate
cout << "Welcome to the Employee Payment Calculator. Please enter the requested information /n" ;
cout << "Please input employee initials: " ;
cin >> employee; cout << endl;
cout << "Please input the hours worked: ";
cin >> hoursWorked; cout << endl;
cout << "Please enter the hourly wage: ";
cin >> hourlyWage; cout << endl;
//Multiply hours worked and hourly wage to get totalWage.
Why doesn't THIS part work?? ---> hourlyWage * hoursWorked = totalWage;
cout << "total wage = " << hoursWorked * hourlyWage << endl;
cin >> hoursWorked * hourlyWage = totalWage;
cout << "internal total wage is " << totalWage;
return 0;
}
The problem is at the end of the code.
#include <iostream>
#include <string>
using namespace std;
const double fedWithholdingRate = 0.18;
const double stateWhithholdingRate=0.045;
const double HospDed = 25.65;
const double UnionDues = 0.02;
string employee;
double
hoursWorked = 0,
hourlyWage = 0,
totalWage = 0,
fedWitholdingAmt = 0,
stateWithholdingAmt = 0,
totDeductions = 0,
netPay = 0;
int main()
{
//Gather the employee intiials, hours worked, and hourly rate
cout << "Welcome to the Employee Payment Calculator. Please enter the requested information /n" ;
cout << "Please input employee initials: " ;
cin >> employee; cout << endl;
cout << "Please input the hours worked: ";
cin >> hoursWorked; cout << endl;
cout << "Please enter the hourly wage: ";
cin >> hourlyWage; cout << endl;
//Multiply hours worked and hourly wage to get totalWage.
Why doesn't THIS part work?? ---> hourlyWage * hoursWorked = totalWage;
cout << "total wage = " << hoursWorked * hourlyWage << endl;
cin >> hoursWorked * hourlyWage = totalWage;
cout << "internal total wage is " << totalWage;
return 0;
}