Whoops! That would be a problem. Also the program does not end when the user enters "S" or "s" and when I enter 3 under the number of registrants, the computer gives an error message. The program just isn't working right and I am at my wits end.
Here is the entire program:
Code:
int main()
{
//declare variables
char company = ' ';
int registrantCount = 0;
double chargePerson = 0.0;
double totalCharge = 0.0;
double averageCharge = 0.0;
double subcharge = 0.0;
//convert variable types
static_cast <double> (registrantCount);
cout << fixed << setprecision (2);
//enter input data
cout << "Enter company (S to stop): " << endl;
cin >> company;
//start loop
while (company != 'S' || company != 's')
{
cout << "Enter number of registrants: " << endl;
cin >> registrantCount;
cout << endl << endl;
if (registrantCount > 0 && registrantCount <=3)
subcharge = registrantCount * 150;
else if (registrantCount > 3 && registrantCount < 10)
subcharge = registrantCount * 100;
else if (registrantCount >= 10)
subcharge = registrantCount * 90;
else
cout << "Incorrect input" << endl;
//end ifs
registrantCount += registrantCount;
totalCharge = totalCharge + subCharge;
cout << "Enter next company (S to stop): " << endl;
cin >> company;
} //end while
//calculate average
averageCharge = totalCharge/registrantCount;
//display output items
cout << "Total number of registrants: " << registrantCount << endl;
cout << "Total charge: " << totalCharge << endl;
cout << "Average charge per person: " << averageCharge << endl;
return 0;
} //end of main function