Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int vouchercheck, vouchervalid, E, $, currency;
- double withoutDiscount, discountedPrice, Deliveryprice; // you don't change all of them lol
- // just prices
- int main()
- {
- void calculateTotalDiscountedGoods();
- void calculateDiscount();
- void calculateTotalDiscountedGoods();
- void checkValidVoucherCode();
- void currencycalculator();
- cout << "Order value without discount: " << char(156);
- cin >> withoutDiscount;
- currencycalculator();
- calculateTotalDiscountedGoods();
- calculateDiscount();
- checkValidVoucherCode();
- system("Pause");
- }
- void currencycalculator()
- {
- if (withoutDiscount > 0)
- {
- char currency;
- cout << "Currency 'E' for euros, '$' for dollars or '#' for N / A : $";
- cin >> (currency);
- switch (currency) // btackets
- {
- case'E':
- cout << "\nCost in Euro " << withoutDiscount * 0.1;
- withoutDiscount = withoutDiscount * 1.1;
- break;
- case'$':
- cout << "\nCost in dollars: " << withoutDiscount * 0.22;
- withoutDiscount = withoutDiscount * 0.22;
- break;
- case'#':
- withoutDiscount;
- break;
- }
- }
- else
- {
- cout << "\nERROR: Currency unknown!";
- }
- }
- void calculateDiscount()
- {
- if(withoutDiscount <= 30.0)
- {
- withoutDiscount = withoutDiscount / 0.2; // you sure that calculations right?
- cout << "\nOrder value with discount: " << char(156) << discountedPrice;
- }
- else
- {
- if (withoutDiscount > 30 && withoutDiscount < 61) // count up all of the { and the } and see if you have an equal amount where?
- {
- withoutDiscount = withoutDiscount / 0.3;
- cout << "\nOrder value with discount: " << char(156) << withoutDiscount;
- }
- else
- {
- if (withoutDiscount >= 60)
- {
- withoutDiscount = withoutDiscount / 0.5;
- cout << "\nOrder value with discount: " << withoutDiscount;
- }
- else
- {
- if (withoutDiscount <= 0)
- {
- cout << "\nERROR: The order value should be a positive number!"; // wheres the closing bracket here well now ive got one extra closing bracket
- }
- }
- }
- }
- }
- void calculateTotalDiscountedGoods()
- {
- double deliverycharge();
- discountedPrice = withoutDiscount + deliverycharge();
- }
- double deliverycharge()
- {
- if (vouchervalid == 0)
- {
- cout << "\nDelivery Charge:" << char(156) << "6.50";
- return 6.5;
- }
- else // brackets ?? // come on man lol wtf u want
- { // was that so fucking hard
- cout << "\nDelivery Charge:" << char(156) << "0.00";
- return 0.00;
- }
- }
- void checkValidVoucherCode()
- {
- int ValidVoucherCode;
- cout << "\nEnter Voucher Code: ";
- cin >> ValidVoucherCode;
- if (ValidVoucherCode >= 1000 && ValidVoucherCode <= 9999) // brackets for the else one where would i put it
- {
- vouchervalid = 1;
- cout << "\nVoucher code: #" << ValidVoucherCode;
- cout << "\nValid voucher - free delivery.";
- cout << "\nDelivery Charge:" << char(156) << "0.00";
- cout << "\nTo Pay: " << char(156) << discountedPrice;//there
- }
- else
- {
- vouchervalid = 0;
- cout << "\nVoucher code:#" << ValidVoucherCode;
- cout << "\nInvalid voucher.";
- cout << "\nDelivery Charge:" << char(156) << "6.50";
- cout << "\nTo Pay: " << char(156) << discountedPrice;
- system("Pause");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement