Answer to Question #258540 in C++ for purchase item

Question #258540

A stationary store uses a system to generate the customer purchase amount. The cashier needs to key in the item code and item quantity. Then, the system calculates the purchase amount and generate a receipt for the customer. Information on item code, item name, item description, item quantity, item price and purchase amount will be printed on the receipt. 



1
Expert's answer
2021-10-29T04:30:10-0400
#include <iostream>


using namespace std;


int main()
{
    int code, qty, amount;
    char name[100];
    cout << "\t\t*****************************" << endl;
    cout << "\t\t\tStationary store" << endl;
    cout << "\t\t*****************************" << endl;
    cout<<"Key in the item code: "<<endl;
    cin>>code;
    cout<<"Key in the item quantity: "<<endl;
    cin>>qty;
    if(code==5070)
    {
        amount=60*qty;
        cout<<"Receipt on the item purchased"<<endl;
        cout<<"The item code: "<<code<<endl;
        cout<<"Item name: Calculator"<<endl;
        cout<<"Item description: FC-100 Financial calculator. Brand: Casio, Type: Financial. Power source: Battery/Solar."<<endl;
        cout<<"Item quantity: "<<qty<<endl;
        cout<<"Item price: $60"<<endl;
        cout<<"Purchase Amount:$ "<<amount<<endl;
        cout<<"--------------------------------"<<endl;
    }
    else if (code==2030)
    {
      amount=5*qty;
        cout<<"Receipt on the item purchased"<<endl;
        cout<<"The item code: "<<code<<endl;
        cout<<"Item name: Counter Book"<<endl;
        cout<<"Item description: Counter Book 6 QUIRE, Size A4 Pages 576, Ref No 236"<<endl;
        cout<<"Item quantity: "<<qty<<endl;
        cout<<"Item price: $4"<<endl;
        cout<<"Purchase Amount:$ "<<amount<<endl;
        cout<<"--------------------------------"<<endl;
    }
     else if (code==1040)
    {
      amount=9*qty;
        cout<<"*******Receipt*********"<<endl;
        cout<<"The item code: "<<code<<endl;
        cout<<"Item name: Graphic Pencil"<<endl;
        cout<<"Item description: Staedtler Lumograph Graphite Drawing And Sketching Pencil set of 6 degrees"<<endl;
        cout<<"Item quantity: "<<qty<<endl;
        cout<<"Item price: $9"<<endl;
        cout<<"Purchase Amount:$ "<<amount<<endl;
        cout<<"--------------------------------"<<endl;
    }
    else
    {
        cout<<"Invalid item code"<<endl;
    }
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS