I'm supposed to be making a bill and it went well up until i needed to have taxes added to the bill and I also ended up being required to use minutes instead of hours for the unit of time And I can't seem to get either to work out right. It keeps telling me that Total hasn't been initialized
<
// This program will calculate the charge of getting surfing lessons including cost of equipment, hourly rate, tax, and a tip.
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
const float TAX_RATE = 0.04f;
const int TITLE_COLUMN_WIDTH = 15;
const int AMOUNT_COLUMN_WIDTH = 10;
int main (void)
{
//// 1.0 Instruct User ////
cout << " Star-Surf Surf Lessons Bill Generator " << endl;
cout << endl;
cout << "Please enter values when prompted:" << endl;
if ( tip < ( subTotal * 0.15))
cout << "Ohhhhhh!!! Big Spender!!!! -_-" ;
else if ( tip > ( subTotal * 0.15 ))
cout << "Thank you for coming" ;
else if (tip > (subTotal * 0.20 ))
cout << "Please come again soon!" ;
}
//// 4.0 Endgame ////
cout << endl;
cout << "Press ENTER to continue..." << endl;
cin.ignore(999,'\n');
return 0;
total = ((hourlyRate * minutesInstructed) + equipmentFee);
BTW, that's going to cause a scaling problem. 30 minutes * an hourly rate of $10 = $150, when you want a result of $5.
cout << "Your total is: " << Total + (Total * TAX_RATE) << endl;
The compiler is correct. You never stored anything into Total. See the comment above regarding cin.
float TAX_RATE;
That's going to hide the global constant by the same name.
PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.