Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C++ by 100701712 ( 7 years ago )
#include <iostream>
#include <iomanip>
using namespace std;

void printReceipt();

int main() {
    printReceipt();
    return 0;
}

void printReceipt() {
    int iCoffeeQty, iDoughnutQty;
    double dCoffeePrice = 4.99, dDoughnutPrice = 1.99, dSubtotal = 0;

    cout << "Please enter the amount of coffees you would like to purchase: ";
    cin >> iCoffeeQty;
    cout << "Please enter the amount of doughnuts you would like to purchase: ";
    cin >> iDoughnutQty;
    cout << "\n\nJim Hortons\n" << "Customer Receipt\n" << "-------------------------\n";

    dSubtotal = (dCoffeePrice * iCoffeeQty) + (dDoughnutPrice * iDoughnutQty);

    cout << setw(23) << left << "Coffee" << right << "x" << right << iCoffeeQty << setw(23) << right << (dCoffeePrice * iCoffeeQty) << endl;
    cout << setw(23) << left << "Doughnut" << right << "x" << right << iDoughnutQty << setw(23) << right << (dDoughnutPrice * iDoughnutQty) << "\n\n";
    cout << setw(23) << left << "Subtotal" << setw(25) << right << dSubtotal << endl;
    cout << setw(23) << left << "HST" << right << "%13" << setw(22) << right << fixed << setprecision(2) << (dSubtotal * 0.13) << "\n\n";
    cout << setw(23) << left << "Total" << setw(25) << right << fixed << setprecision(2) << (dSubtotal * 1.13);
}

 

Revise this Paste

Your Name: Code Language: