Net Price Calculation

 Introduction

Items in a department store or any other store usually display the price of an item. Customers take such an item to the cashier who rings it, applies the tax rate and present the total price to the customer.

The marked price, the price presented on an item, is in currency value. An example would be \$120.95

The tax rate is expressed as a percentage value. An example would be 5.75%

The computer used to evaluate the price use a formula such as:

Tax Amount = Marked Price / Tax Rate

The net price, the actual price a customer should pay, is calculated as:

Net Price = Marked Price + Tax Amount

In this exercise, we will simulate such a calculation
 Starting the Application
 Start Borland C++ Builder. Save the Project as NetPrice in a new folder named Net Price Save the unit as Main

 Designing the Application
1. Design the dialog box as follows:

2. Set the Names of the Edit and Button controls to

 Edit Button edtMarkedPrice btnCalculate edtTaxRate btnClose edtTaxAmount edtNetPrice
 ```//--------------------------------------------------------------------------- void __fastcall TForm1::btnCloseClick(TObject *Sender) { Close(); } //--------------------------------------------------------------------------- void __fastcall TForm1::btnCalculateClick(TObject *Sender) { double MarkedPrice, TaxRate, TaxAmount, NetPrice; MarkedPrice = StrToFloat(edtMarkedPrice->Text); TaxRate = StrToFloat(edtTaxRate->Text) / 100; TaxAmount = MarkedPrice * TaxRate; NetPrice = MarkedPrice + TaxAmount; edtTaxAmount->Text = FloatToStrF(TaxAmount, ffCurrency, 6, 2); edtNetPrice->Text = FloatToStrF(NetPrice, ffCurrency, 6, 2); } //---------------------------------------------------------------------------```