BASIC PROBLEM | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 2

BASIC PROBLEM

Write a C program that conforms to the following situation description. Meryem and Ahmed walk into a candy (sweets) store that sells 3 types of candy. There is a limited supply of each in the store because there are many customers and they all love buying candy. The candy types are listed below together with the amount available and the price per unit: 1) chocolate bars – 10 available, 10 dh per candy bar; 2) mint drops – 15 packets available, 12 dh per packet; 3) gummy bears – 5 bags available (I bought the rest J), 15 dh per packet. Meryem and Ahmed jointly have 100 dh and they are planning to spend it all on candy. But they are each only allowed to buy one kind of candy. The store keeper (the program) starts by greeting the customers, then asks them what they want. Since March is women’s month, ladies go first. So the store keeper asks (prompts): Which kind of candy do you want Meryem, and how much? Meryem needs to give the information (enter it). The store keeper then asks Ahmed for the same information. If either Meryem or Ahmed choose a candy type that is not sold in the store, they must be told that. If either of them wants a quantity greater than what is available, then they must be told that too, and they should be reminded of what quantity IS available. (Keep in mind that, for example, if Meryem wants 3 bags of gummy bears, only 2 will be left for Ahmed to buy, if he wants them). The store keeper then tells the customers what they each bought and how much they individually and jointly spent. Finally, since their joint purchase cannot exceed the 100 dh that they have together, the store keeper must tell them if it does. Before exiting the store keeper should say goodbye and ask the customers to come back. https://code.sololearn.com/cDXi6LZ3G6F0/?ref=app

15th Mar 2020, 2:58 PM
Oussama Mouh
2 Answers
0
Whats really your question here? You can post this on your feed and not the q&a please follow the community guidelines https://www.sololearn.com/discuss/1316935/?ref=app
15th Mar 2020, 7:46 PM
✳AsterisK✳
✳AsterisK✳ - avatar
0
thanks
15th Mar 2020, 8:29 PM
Oussama Mouh