# You have just started a new stationary shop. Your profit-per-item depends on the total quantity of item sold. Hide Copy Code Your profit-per-item depends on the total quantity of item sold. The scheme shown below is used to determine the total profit: Quantity Profit-per-item 0–1000 \$1 1001–5000 \$2 5001 and above \$5 Save Note that this is a graduated profit. The profit for selling up to 1000 items is \$1, for next 4000 items is \$2 and beyond that is \$5. If the total quantity of item sold is 10000, the profit is 1000 * \$1 + 4000 * \$2 + 5000 * \$5 = \$34000. Your goal is to make \$50,000 a year. Write a program that uses a do-while loop to find out the minimum quantity of item you have to sell in order to make \$50,000

Wed Oct 28 2020 10:55:45 GMT+0000 (UTC)

Saved by @mahmoud hussein #c++

```#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;

int main()
{

int firstprofit = 0;
int quantity = 0;
int q3 = 1;

//the targeted profit >> 50000
cout << "Enter the profit ";
int endProfit;
cin >> endProfit;

//first five quantity 1 * 1000+2 * 4000
firstprofit += 9000;
do
{
//the remaining quantity(q3) which is 50000(endProfit) - 9000(firstProfit) / 5
if (q3 == (endProfit - 9000) / 5)

firstprofit += q3 * 5;
else
q3++;

} while (firstprofit <= endProfit);

//the whole quantity
quantity += 1000 + 4000 + q3;

cout << quantity;

}```
content_copyCOPY

http://cpp.sh/