You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
1.2 KiB

  1. #include "CustomerMenu.h"
  2. void customerChoiceForMenuItem(int numberOfMenuItem)
  3. {
  4. switch(numberOfMenuItem){
  5. case 1:
  6. printf("You have chosen to send money.\n");
  7. //call sendMoney();
  8. break;
  9. case 2:
  10. printf("You have chosen to withdraw money.\n");
  11. //call withDrawMoney();
  12. break;
  13. case 3:
  14. printf("You have chosen to deposit money.\n");
  15. //call depositMoney();
  16. break;
  17. case 4:
  18. printf("You have chosen to request a loan.\n");
  19. //call requestLoan();
  20. break;
  21. default:
  22. printf("Invalid input.\n",numberOfMenuItem);
  23. }
  24. }
  25. void showAllMenuEntries()
  26. {
  27. int userDecision = 0;
  28. puts("\n\n");
  29. puts("CUSTOMER MENU");
  30. puts("\n");
  31. printf("Select between (1-4):");
  32. puts("\n\n\n");
  33. printf("->->->1. send money<-<-<-");
  34. puts("\n\n\n");
  35. printf("->->->2. withdraw money<-<-<-");
  36. puts("\n\n\n");
  37. printf("->->->3. deposit money<-<-<-");
  38. puts("\n\n\n");
  39. printf("->->->4. request loan<-<-<-");
  40. puts("\n\n\n");
  41. puts("Your decision: ");
  42. scanf("%d",&userDecision);
  43. customerChoiceForMenuItem(userDecision);
  44. }
  45. void menu(customer_t *c)
  46. {
  47. if(c==NULL){
  48. puts("Invalid pointer. Aborting.\n");
  49. exit(-1);
  50. }else{
  51. printf("Welcome %s %s!\n",c->forename, c->surname);
  52. printf("Balance: %.4f€\n",c->balance);
  53. showAllMenuEntries();
  54. }
  55. }