Practical Three

Tax Calculations

due : 4pm 14 March 1997


Write a program that calculates the tax details of a purchase, using program modules to create a layer of abstraction.

The program must allow the user to input an amount issued as payment for some goods. Then it will pass this information to the TaxMan object, which calculates the details, formats and displays them.

The TaxMan object must be created to be of type TaxType, as follows:

class TaxType
{
   float Tax_Percentage;
public:
   TaxType ( int TaxPercentage );
   void ShowDetails ( float Amount );
};

This declaration must be stored in a header file (TAXTYPE.H). TaxType must be defined to calculate tax according to the rules of General Sales Tax (value of goods is exclusive of tax), and this definition must be stored in GST.CPP.

The main program must include TAXTYPE.H and be linked against GST.CPP to produce a GST calculation program.

After this is working, create a second source file called VAT.CPP, which defines TaxType for Value Added Tax (value of goods is inclusive of tax). Re-compile your program and link it against VAT.CPP this time.

Use project files to facilitate linking against different source files. Submit the source files (PRAC3.CPP, TAXTYPE.H, GST.CPP, VAT.CPP), project files (GST.PRJ, VAT.PRJ) and executables (GST.EXE, VAT.EXE).