Advertisement
Guest User

Untitled

a guest
Nov 19th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.59 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int withoutDiscount, discountedPrice, Deliveryprice, deliverycharge, vouchercheck, vouchervalid, E, $, currency;
  4.  
  5. int main()
  6. {
  7. void calculateTotalDiscountedGoods();
  8. void calculateDiscount();
  9. void checkValidVoucherCode();
  10. void currencycalculator();
  11. cout << ("Order value without discount: " << char(156));
  12. cin >> (withoutDiscount);
  13. cout << ("Enter Voucher Code: " << char(156));
  14. cin >> (checkValidVoucherCode);
  15. cout << ("Order value with discount: " << char(156));
  16. cin >> (discountedPrice);
  17. calculateDiscount();
  18. currencycalculator();
  19. checkValidVoucherCode();
  20. calculateTotalDiscountedGoods();
  21.  
  22. }
  23.  
  24. void currencycalculator()
  25. {
  26. if (withdiscount > 0)
  27. {
  28. cout << ("Currency('E' for euros, '$' for dollars or '#' for N / A) : $");
  29. cin >> (currency);
  30. char currency = 'E', '$', '#';
  31. switch withdiscount
  32. case'E':
  33. cout << ("Cost in Euro ", withoutDiscount)
  34. withoutDiscount * 1.1;
  35. break;
  36. case'$':
  37. withoutDiscount * 1.22;
  38. cout << ("Cost in dollars: ", withoutDiscount)
  39. break;
  40. case'#':
  41. withoutDiscount;
  42. break;
  43. else
  44. cout("ERROR: Currency unknown!");
  45. }
  46.  
  47. void calculateDiscount()
  48. {
  49. if (withoutDiscount =< 30)
  50. {
  51. withoutDiscount / 0.2;
  52. cout << ("\nOrder value with discount: " << char(156));
  53. cout << (discountedPrice);
  54. }
  55. else
  56. if (withoutDiscount > 30 && < 61) {
  57. withoutDiscount / 0.3;
  58. cout << ("\nOrder value with discount:char(156) ");
  59. cout << (discountedPrice);
  60. }
  61. else
  62. if (withoutDiscount >= 60)
  63. {
  64. withoutDiscount / 0.5;
  65. cout << "\nOrder value with discount: ";
  66. cout << (discountedPrice);
  67. }
  68.  
  69. else if (withoutDiscount <= 0)
  70. {
  71.  
  72.  
  73.  
  74. cout << "\nERROR: The order value should be a positive number!;
  75. }
  76. }
  77.  
  78. void calculateTotalDiscountedGoods()
  79. {
  80. discountedPrice + deliverycharge;
  81. }
  82.  
  83. void deliverycharge()
  84. {
  85. if(vouchervalid == 0)
  86. cout << ("Delivery Charge:" << char(156) "6.50")
  87. else
  88. cout << ("Delivery Charge:" << char(156) "0.00")
  89. }
  90.  
  91. void checkValidVoucherCode()
  92. {
  93. if (checkValidVoucherCode >= 1000 && <= 9999)
  94. set(vouchervalid == 1);
  95. cout << ("Voucher code: #", checkValidVoucherCode)
  96. cout << ("Valid voucher - free delivery.")
  97. cout << ("Delivery Charge:" << char(156) "0.00")
  98. cout << ("To Pay: "<< char(156), calculateTotalDiscountedGoods)
  99. else {
  100. set(vouchervalid == 0)
  101. cout << ("Voucher code:#", checkValidVoucherCode)
  102. cout << ("Invalid voucher.")
  103. cout << ("Delivery Charge:" << char(156) "6.50")
  104. cout << ("To Pay: " << char(156), calculateTotalDiscountedGoods)
  105. system("Pause");
  106. }
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement