A store uses the following policy to award discount. If the customer purchases

products costing more than ksh 30,000 she is given a discount of 10%, otherwise
she is given a discount of 2%. Write a complete C++ program that allows a user
to input the total value of purchases then the program computes and outputs the
discount a customer will receive.

kjhl

To write a C++ program that calculates the discount based on the total value of purchases, you can follow these steps:

1. Include the necessary header files for input/output operations:
```cpp
#include <iostream>
using namespace std;
```

2. Declare the main function:
```cpp
int main() {
// Your code goes here

return 0;
}
```

3. Declare variables to store the total value of purchases and the discount:
```cpp
double totalValue;
double discount;
```

4. Ask the user to input the total value of purchases:
```cpp
cout << "Enter the total value of purchases: ";
cin >> totalValue;
```

5. Apply the discount policy:
```cpp
if (totalValue > 30000) {
discount = totalValue * 0.1;
} else {
discount = totalValue * 0.02;
}
```

6. Output the discount amount:
```cpp
cout << "Discount: " << discount << endl;
```

7. Complete the program by adding the closing brackets for the main function:
```cpp
int main() {
// Variable declarations...

// Input total value of purchases...

// Calculate discount...

// Output the discount...

return 0;
}
```

Here is the complete program:

```cpp
#include <iostream>
using namespace std;

int main() {
double totalValue;
double discount;

cout << "Enter the total value of purchases: ";
cin >> totalValue;

if (totalValue > 30000) {
discount = totalValue * 0.1;
} else {
discount = totalValue * 0.02;
}

cout << "Discount: " << discount << endl;

return 0;
}
```

With this program, the user can input the total value of purchases, and the program will calculate and output the discount based on the provided discount policy.