Advertisement
Guest User

Untitled

a guest
Oct 26th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.72 KB | None | 0 0
  1. #include <dos.h>
  2. #include <io.h>
  3. #include <stdio.h>
  4. #include <string.h>
  5.  
  6. void beep()
  7. {
  8. // sound (200);
  9. // delay(25);
  10. // nosound();
  11.  
  12. return;
  13. }
  14.  
  15.  
  16. void main ()
  17. {
  18. char trn[9], f_name[15], l_name[15], phonenum[7], repair_code, deposit_decision;
  19. float balance, cost, gct, total, deposit_amt;
  20. int serv_time=0,SHOE_NUMBER,pickup;
  21. const EXPRESS_RATE = 1.5 ;
  22. const GCT_RATE = 0.165; // 16.5%
  23. const HEEL_RATE = 500;
  24. const STITCH_RATE = 700;
  25. const PATCH_RATE = 300;
  26. const STD_HEEL_TECH_RATE = 1000;
  27. const STD_STITCH_TECH_RATE = 1300;
  28. const STD_PATCH_TECH_RATE = 1000;
  29.  
  30. while (1) {
  31. printf ("\n\r Please Enter your First Name: ");
  32. scanf ("%s", &f_name);
  33. // beep();
  34. printf ("\n\r Please enter your Last Name: ");
  35. scanf ("%s", &l_name);
  36.  
  37. printf ("\n\r Please Enter your TRN Number: ");
  38. scanf ("%s", &trn);
  39. if (strcmp ("XXX",strupr(trn)) == 0) return;
  40.  
  41. printf (" \n\r Please Enter your Contact Number: ");
  42. scanf ("%s", &phonenum);
  43. do {
  44. printf ("\n\r Please enter the amount of shoes to be repaired: ");
  45. scanf ("%d", &SHOE_NUMBER);
  46.  
  47. if ((SHOE_NUMBER != 1) && (SHOE_NUMBER != 2)) {
  48. printf("We only accept 1 or 2.\n \n");
  49. }
  50. } while ((SHOE_NUMBER != 1) && (SHOE_NUMBER != 2));
  51. //Available times are 30,60,180, minutes.
  52.  
  53. do {
  54. printf ("\n\r Please Select the type of repair you are requesting to be done... \n");
  55. printf (" (H) For Heel Tip Replacement \n");'H';
  56. printf (" (S) For Stretching \n"); 'S';
  57. printf (" (P) For Patching \n"); 'P';
  58. scanf ( " %c", &repair_code);
  59. repair_code = toupper(repair_code);
  60. if ((repair_code != 'H') && (repair_code != 'S') && (repair_code!= 'P')) {
  61. printf("Please enter H,S or P \n ");
  62. }
  63. } while ((repair_code != 'H') && (repair_code != 'S') && (repair_code!= 'P'));
  64.  
  65. printf ("\n\r What is the estimated time you would like the shoe to be repaired? ");
  66. scanf ("%d", &serv_time);
  67.  
  68. if (serv_time > 30 && repair_code == 'H' ) {
  69. cost =(SHOE_NUMBER * HEEL_RATE) + (STD_HEEL_TECH_RATE * SHOE_NUMBER);
  70. printf(" test1");
  71. }
  72. else if (serv_time == 30 && repair_code == 'H')
  73. {
  74. cost =(SHOE_NUMBER * HEEL_RATE) + (STD_HEEL_TECH_RATE * SHOE_NUMBER) + (STD_HEEL_TECH_RATE * EXPRESS_RATE) ;
  75. printf(" test2");
  76. }
  77. else if (serv_time > 30 && repair_code == 'S')
  78. {
  79. cost = (SHOE_NUMBER * STITCH_RATE);
  80. printf(" test3");
  81. }
  82. else if (serv_time == 30 && repair_code == 'S')
  83. {
  84. cost = (SHOE_NUMBER * STITCH_RATE) + (STD_STITCH_TECH_RATE * SHOE_NUMBER) + (STD_STITCH_TECH_RATE * EXPRESS_RATE) ;
  85. printf(" test4");
  86. }
  87. else if (serv_time > 30 && repair_code == 'P')
  88. {
  89. cost = (SHOE_NUMBER * PATCH_RATE);
  90. printf(" test5");
  91. }
  92. else if (serv_time == 30 && repair_code =='P' )
  93. {
  94. cost = (SHOE_NUMBER * PATCH_RATE) + (STD_PATCH_TECH_RATE * SHOE_NUMBER) + (STD_PATCH_TECH_RATE * EXPRESS_RATE);
  95. printf(" test6");
  96. }
  97.  
  98.  
  99.  
  100.  
  101. printf ("\n\r Would you like to make a deposit?");
  102. scanf(" %c",&deposit_decision);
  103.  
  104. if (deposit_decision == 'Y');
  105. {
  106. printf ("\n\r How much would you like to deposit?");
  107. scanf (" %d", &deposit_amt);
  108. }
  109.  
  110.  
  111. //Calcuations
  112. gct = (GCT_RATE*cost);
  113. balance = deposit_amt - cost;
  114. total = (cost+gct) - balance;
  115.  
  116. printf( "\n\n\n\r\t\t Service Log \n");
  117. printf ("Customer Name: %s %s \n", f_name,l_name);
  118. printf ("TRN Number: %s . \n"),trn;
  119. printf ("Repair Code: %c. \n",repair_code);
  120. printf ("The number of shoes submitted: %i.\n"),SHOE_NUMBER ;
  121. printf ("The total service cost is: %i\n"),cost;
  122. printf ("The GCT is: %i \n"),gct;
  123. printf ("The amount deposited was: %i \n"),deposit_amt;
  124. printf ("The balance is: %i \n" ),balance;
  125. printf ("The total cost is: %i \n" ),total;
  126. printf ("\nThank you for making it Shoe Spec , We hope you enjoyed our services. \n");
  127. /*printf (" \n \n");
  128. printf (" * * * * * * * *\n");
  129. printf (" * * * * \n ");
  130. printf (" * ** *\n");
  131. printf (" * Done By * \n");
  132. printf (" * Jhevante Mcdonald * \n");
  133. printf (" * 1500155 * \n");
  134. printf (" * * \n");
  135. printf (" * University * \n");
  136. printf (" * Of *\n");
  137. printf (" * Technology, * \n");
  138. printf (" * Jamaica * \n");
  139. printf (" * * \n");
  140. printf (" * Y2Sem1 * \n");
  141. printf (" * * \n");
  142. printf (" * * \n");
  143. printf (" ***** \n");
  144. getch();
  145.  
  146. */
  147. }
  148. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement