/* Program written by Carol Wolf, October 7, 1998
This program uses a class called store to model a store.
The class has methods to get the price of an item, calculate
the tax and the bill, and display the results. The class is
used by a main function. */

#include <iostream>
#include <conio>

class store
{
    public:
        store ();
        void calculate_tax ();
        void display_bill ();
        void get_price ();
        void calculate_bill ();
    private:
        double price, tax, tax_rate, bill;
}; // class store

store :: store ()
{
    tax_rate = 0.0825;
} // store :: store ()

void store :: calculate_tax ()
{
    tax = price * tax_rate;
} // void store :: calculate_tax ()

void store :: display_bill ()
{
    cout.precision (2);
    cout.setf (ios :: fixed | ios :: showpoint);
    cout.width (6);
    cout << "The price is: " << price << endl;
    cout << "The tax is: " << tax << endl;
    cout << "The total bill is: " << bill << endl;
} // void store :: display_bill ()

void store :: get_price ()
{
    cout << "Enter the price: ";
    cin >> price;
} // void store :: get_price ()

void store :: calculate_bill ()
{
    bill = tax + price;
} //void store :: calculate_bill ()

int main ()
{
    store staples;
    staples.get_price ();
    staples.calculate_tax ();
    staples.calculate_bill ();
    staples.display_bill ();
    getch ();
} // int main ()