Advertisement
Guest User

Untitled

a guest
Nov 19th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.19 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int vouchercheck, vouchervalid, E, $, currency;
  4. double withoutDiscount, discountedPrice, Deliveryprice; // you don't change all of them lol
  5.  
  6.  
  7.  
  8.  
  9. // just prices
  10. int main()
  11. {
  12. void calculateTotalDiscountedGoods();
  13. void calculateDiscount();
  14. void calculateTotalDiscountedGoods();
  15. void checkValidVoucherCode();
  16. void currencycalculator();
  17.  
  18. cout << "Order value without discount: " << char(156);
  19. cin >> withoutDiscount;
  20.  
  21.  
  22. currencycalculator();
  23. calculateTotalDiscountedGoods();
  24. calculateDiscount();
  25. checkValidVoucherCode();
  26. system("Pause");
  27. }
  28.  
  29. void currencycalculator()
  30. {
  31. if (withoutDiscount > 0)
  32. {
  33. char currency;
  34. cout << "Currency 'E' for euros, '$' for dollars or '#' for N / A : $";
  35. cin >> (currency);
  36. switch (currency) // btackets
  37. {
  38. case'E':
  39. cout << "\nCost in Euro " << withoutDiscount * 0.1;
  40. withoutDiscount = withoutDiscount * 1.1;
  41. break;
  42. case'$':
  43. cout << "\nCost in dollars: " << withoutDiscount * 0.22;
  44. withoutDiscount = withoutDiscount * 0.22;
  45. break;
  46. case'#':
  47. withoutDiscount;
  48. break;
  49. }
  50. }
  51. else
  52. {
  53. cout << "\nERROR: Currency unknown!";
  54. }
  55. }
  56.  
  57. void calculateDiscount()
  58. {
  59. if(withoutDiscount <= 30.0)
  60. {
  61. withoutDiscount = withoutDiscount / 0.2; // you sure that calculations right?
  62.  
  63. cout << "\nOrder value with discount: " << char(156) << discountedPrice;
  64. }
  65. else
  66. {
  67. if (withoutDiscount > 30 && withoutDiscount < 61) // count up all of the { and the } and see if you have an equal amount where?
  68. {
  69. withoutDiscount = withoutDiscount / 0.3;
  70. cout << "\nOrder value with discount: " << char(156) << withoutDiscount;
  71. }
  72. else
  73. {
  74. if (withoutDiscount >= 60)
  75. {
  76. withoutDiscount = withoutDiscount / 0.5;
  77. cout << "\nOrder value with discount: " << withoutDiscount;
  78.  
  79. }
  80.  
  81. else
  82. {
  83. if (withoutDiscount <= 0)
  84. {
  85. cout << "\nERROR: The order value should be a positive number!"; // wheres the closing bracket here well now ive got one extra closing bracket
  86. }
  87. }
  88. }
  89. }
  90. }
  91.  
  92. void calculateTotalDiscountedGoods()
  93. {
  94. double deliverycharge();
  95. discountedPrice = withoutDiscount + deliverycharge();
  96. }
  97.  
  98. double deliverycharge()
  99. {
  100. if (vouchervalid == 0)
  101. {
  102. cout << "\nDelivery Charge:" << char(156) << "6.50";
  103. return 6.5;
  104. }
  105. else // brackets ?? // come on man lol wtf u want
  106. { // was that so fucking hard
  107. cout << "\nDelivery Charge:" << char(156) << "0.00";
  108. return 0.00;
  109. }
  110. }
  111.  
  112. void checkValidVoucherCode()
  113. {
  114. int ValidVoucherCode;
  115. cout << "\nEnter Voucher Code: ";
  116. cin >> ValidVoucherCode;
  117. if (ValidVoucherCode >= 1000 && ValidVoucherCode <= 9999) // brackets for the else one where would i put it
  118. {
  119. vouchervalid = 1;
  120. cout << "\nVoucher code: #" << ValidVoucherCode;
  121. cout << "\nValid voucher - free delivery.";
  122. cout << "\nDelivery Charge:" << char(156) << "0.00";
  123. cout << "\nTo Pay: " << char(156) << discountedPrice;//there
  124. }
  125. else
  126. {
  127. vouchervalid = 0;
  128. cout << "\nVoucher code:#" << ValidVoucherCode;
  129. cout << "\nInvalid voucher.";
  130. cout << "\nDelivery Charge:" << char(156) << "6.50";
  131. cout << "\nTo Pay: " << char(156) << discountedPrice;
  132. system("Pause");
  133. }
  134. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement