I am supposed to be writing a program that will calculate sales in a week. Every week 200.00 dollars is earned, then sales is calculated on top of the 200.00 (i.e., 5000.00 in sales, would be 200 + .09 * 5000.00). My code is below, but I am having problems with the calculations. When I run the program it continues to give me 200.00 dollars for the week. Not sure how to approach this.
// this program will calculate the input of each salesperson's gross sales
// from the last week and calculate and display that salesperson's earnings
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
double ttlsales, weeklyearnings;
ttlsales = 0;
weeklyearnings = 0;
cout << "Enter the total sales for the week, (-1 will end program): ";
cin >> ttlsales;
while (ttlsales >= 1)
{
ttlsales = (.09 * weeklyearnings) + 200;
cout << "Total earnings are: " << setprecision (2)
<< fixed << ttlsales << endl;
cout << "Enter the next sales person's total sales for the week,\n"
"(-1 will end program): ";
cin >> ttlsales;
}
cout << "The program will now end." << endl;
return 0;
}