Untitled
unknown
plain_text
4 years ago
928 B
5
Indexable
Since we are creating a menu driven program. We start first by defining a function to display the menu. The function is named displayDetails(). It takes no arguments and has void return type. It only displays the coffee shop name and the size of cups available. Now for customer to interact with the shopkeeper, we create getChoice() function to take customer's input regarding his/her coffee size choice. We take the input as 1/2/3 and then store it. Now, for the given choice, we run a switch statement in the main() function and then call the functions sellCoffee() which adds the amount to be charged and resets the loop for the user to choose again. We continue it as long as the user wishes. At the end, we show the details for the user regarding amount of coffee purchased and then generate the bill and show the amount to be charged. We also user AmountMade() function to display the amount earned by the shopkeeper
Editor is loading...