Shoprite is a grocery shop that has outlets nationwide. They give discounts to customers who buy products in bulk. For a given number of products their discounts are as follows:
Quantity | Discount |
---|---|
0 – 20 | No discount |
More than 20 | 10% |
More than 30 | 15% |
More than 40 | 20% |
More than 50 | 30% |
They are planning to get a computerised system which automates calculation of total amount due for a given number of products.
- Based on the above scenario, design a solution for Shoprite using a flowchart.
- Based on the outcome of Question 3.1, create a C++ program using Visual Studio. Your program must enter the quantity of products then compute the discount based on the quantity and output the total amount due.
Click on the below link to download flowchart:
Click on below attachment link to Download the Flowchart
Download the Flowchart From the Below Attachment Link:
CODE:
//VISIT SIKSHAPATH.IN FOR MORE #include<iostream> using namespace std; int main() { int qty,price; float discount,total; cout<<"Enter Quatity:"; cin>>qty; cout<<"Enter the Price:"; cin>>price; if(qty<20) discount=0; else if(qty<30) discount=0.1; else if(qty<40) discount=0.15; else if(qty<50) discount=0.2; else discount=0.3; total=qty*price; discount=discount*total; cout<<"Total amount used:"<<total<<endl; cout<<"Eligibile discount:"<<discount<<endl; total=total-discount; cout<<"Grand Total:"<<total<<endl; }