|
CD Publisher |
|
|
|
|
In this exercise, we will develop an application for a small CD publishing company. The owner wants the prices to be calculated so a customer would get a discount if he orders more. To attract customers and encourage them to order more, she has decided to fix the prices so that the customer would pay:
|
![]() |
||||||||||||||||||||||||||||||||
|
private void btnClose_Click (Object sender, System.EventArgs e)
{
Close();
}
|
private void updQuantity_ValueChanged (Object sender, System.EventArgs e)
{
int Quantity;
double UnitPrice, TotalPrice;
Quantity = System.Convert.ToInt32(updQuantity.get_Value());
if( Quantity < 20 )
UnitPrice = 20;
else if( Quantity < 50 )
UnitPrice = 15;
else if( Quantity < 100 )
UnitPrice = 12;
else if( Quantity < 500 )
UnitPrice = 8;
else
UnitPrice = 5;
TotalPrice = Quantity * UnitPrice;
txtUnitPrice.set_Text(String.Format("{0:C}", (System.Double)UnitPrice));
txtTotalPrice.set_Text(String.Format("{0:C}", (System.Double)TotalPrice));
}
|
|
|
||
| Copyright © 2004 FunctionX, Inc. | ||
|
|
||