Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int withoutDiscount, discountedPrice, Deliveryprice, deliverycharge, vouchercheck, vouchervalid, E, $, currency;
- int main()
- {
- void calculateTotalDiscountedGoods();
- void calculateDiscount();
- void checkValidVoucherCode();
- void currencycalculator();
- cout << ("Order value without discount: " << char(156));
- cin >> (withoutDiscount);
- cout << ("Enter Voucher Code: " << char(156));
- cin >> (checkValidVoucherCode);
- cout << ("Order value with discount: " << char(156));
- cin >> (discountedPrice);
- calculateDiscount();
- currencycalculator();
- checkValidVoucherCode();
- calculateTotalDiscountedGoods();
- }
- void currencycalculator()
- {
- if (withdiscount > 0)
- {
- cout << ("Currency('E' for euros, '$' for dollars or '#' for N / A) : $");
- cin >> (currency);
- char currency = 'E', '$', '#';
- switch withdiscount
- case'E':
- cout << ("Cost in Euro ", withoutDiscount)
- withoutDiscount * 1.1;
- break;
- case'$':
- withoutDiscount * 1.22;
- cout << ("Cost in dollars: ", withoutDiscount)
- break;
- case'#':
- withoutDiscount;
- break;
- else
- cout("ERROR: Currency unknown!");
- }
- void calculateDiscount()
- {
- if (withoutDiscount =< 30)
- {
- withoutDiscount / 0.2;
- cout << ("\nOrder value with discount: " << char(156));
- cout << (discountedPrice);
- }
- else
- if (withoutDiscount > 30 && < 61) {
- withoutDiscount / 0.3;
- cout << ("\nOrder value with discount:char(156) ");
- cout << (discountedPrice);
- }
- else
- if (withoutDiscount >= 60)
- {
- withoutDiscount / 0.5;
- cout << "\nOrder value with discount: ";
- cout << (discountedPrice);
- }
- else if (withoutDiscount <= 0)
- {
- cout << "\nERROR: The order value should be a positive number!;
- }
- }
- void calculateTotalDiscountedGoods()
- {
- discountedPrice + deliverycharge;
- }
- void deliverycharge()
- {
- if(vouchervalid == 0)
- cout << ("Delivery Charge:" << char(156) "6.50")
- else
- cout << ("Delivery Charge:" << char(156) "0.00")
- }
- void checkValidVoucherCode()
- {
- if (checkValidVoucherCode >= 1000 && <= 9999)
- set(vouchervalid == 1);
- cout << ("Voucher code: #", checkValidVoucherCode)
- cout << ("Valid voucher - free delivery.")
- cout << ("Delivery Charge:" << char(156) "0.00")
- cout << ("To Pay: "<< char(156), calculateTotalDiscountedGoods)
- else {
- set(vouchervalid == 0)
- cout << ("Voucher code:#", checkValidVoucherCode)
- cout << ("Invalid voucher.")
- cout << ("Delivery Charge:" << char(156) "6.50")
- cout << ("To Pay: " << char(156), calculateTotalDiscountedGoods)
- system("Pause");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement