Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Q1: Understand the problem Q2: Map into more suitable abstract representation Q3

ID: 3592784 • Letter: Q

Question

Q1: Understand the problem

Q2: Map into more suitable abstract representation

Q3: Draw state diagram ( Moore )

Q4: State Minimization

Q5: State Encoding ( K-Map )

Q6: Choose FFs for implementation

Q7: Implementation

Q6: Choose FFs for implementation

Q7: Implementation

UAE Vending Machine The UAE Vending machine delivers a Soda and candy the price of kandy is 75 Fils and the price of Soda is one Dirham. The machine has a single coin slot and gives back change. The machine accepts the following coins only. 25 Fils Coins 50 Fils Coins Dirham 100 Fils Coins If the total credit is more than one Dirham , it returns the difference so only - one Dirham credit remains. Dispenses a candy bar if the candy button is pushed and there is 75 Fils credit. Dispenses a candy bar and returns 25 Eils if the candy button is pushed and there is one Dirham credit. Dispenses a soda if the soda button is pushed and there is one Dirham credit.

Explanation / Answer

#include int main() { float money; int choice; float change; printf("Name list of beverage: "); printf(" "); printf("1. Pepsi"); printf(" RM1.00 "); printf("2. Miranda"); printf(" RM1.00 "); printf("3. Mountain Dew"); printf(" RM1.00 "); printf("4. Coca Cola"); printf(" RM1.00 "); printf("5. Revive"); printf(" RM1.00 "); printf("6. Nestle Milo"); printf(" RM2.00 "); printf("7. Cincau"); printf(" RM1.00 "); printf("8. Chrysanthemum Tea"); printf(" RM1.00 "); printf("9. Lipton Ice Lemon Tea"); printf(" RM1.00 "); printf("10. Mineral Water"); printf(" RM1.00 "); printf("11. Cadburry Black Forest"); printf(" RM3.60 "); printf("12. Kitkat"); printf(" RM2.00 "); printf("13. Crispy"); printf(" RM2.00 "); printf("14. Crunch"); printf(" RM2.50 "); printf("15. Mars"); printf(" RM2.50 "); printf("16. Kinder Bueno"); printf(" RM2.50 "); printf("17. White Kinder Bueno"); printf(" RM2.50 "); printf("18. Milky Bar"); printf(" RM2.00 "); printf("19. M&M"); printf(" RM2.50 "); printf("20. Choki Choki"); printf(" RM2.00 "); printf(" "); printf("Enter your choice: "); scanf("%d",&choice); switch(choice) { case 1: printf("You choose Pepsi"); printf(" RM1.00 "); break; case 2: printf("You choose Miranda"); printf(" RM1.00 "); break; case 3: printf("You choose Mountain Dew"); printf(" RM1.00 "); break; case 4: printf("You choose Coca Cola"); printf(" RM1.00 "); break; case 5: printf("You choose Revive"); printf(" RM1.00 "); break; case 6: printf("You choose Nestle Milo"); printf(" RM2.00 "); break; case 7: printf("You choose Cincau"); printf(" RM1.00 "); break; case 8: printf("You choose Chrysanthemum Tea"); printf(" RM1.00 "); break; case 9: printf("You choose Lipton Ice Lemon Tea"); printf(" RM1.00 "); break; case 10: printf("You choose Mineral Water"); printf(" RM1.00 "); break; case 11: printf("You choose Cadburry Black Forest"); printf(" RM3.60 "); break; case 12: printf("You choose Kitkat"); printf(" RM2.00 "); break; case 13: printf("You choose Crispy"); printf(" RM2.00 "); break; case 14: printf("You choose Crunch"); printf(" RM2.50 "); break; case 15: printf("You choose Mars"); printf(" RM2.50 "); break; case 16: printf("You choose Kinder Bueno"); printf(" RM2.50 "); break; case 17: printf("You choose White Kinder Bueno"); printf(" RM2.50 "); break; case 18: printf("You choose Milky Bar"); printf(" RM2.00 "); break; case 19: printf("You choose M&M"); printf(" RM2.50 "); break; case 20: printf("You choose Choki Choki"); printf(" RM2.00 "); break; default: printf("Invalid input! "); break; } printf("Enter your money: "); scanf("%.2f",&money); printf(" "); if (money > 0) printf("ACCEPTED! "); else printf("NOT ACCEPTED! "); printf(" "); change = money - choice; printf("Your change is %.2f", change); return 0; }