| | |
Price Calculations
Please support our C# advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Mar 2005
Posts: 10
Reputation:
Solved Threads: 0
Hi I am trying to write an app for price calculations what i need to do is make cut off points for different dollar values the values are when a product is over $22.00 the deduction $3.30. When a product is over $16.50 and under $22.00 the deduction is dollar value -15%-$1.81 and when the product is under $16.50 the deduction is dollar value -24%-.32cents.I am new to code writing and need help thankyou barry t
•
•
•
•
Originally Posted by barry t
Hi I am trying to write an app for price calculations what i need to do is make cut off points for different dollar values the values are when a product is over $22.00 the deduction $3.30. When a product is over $16.50 and under $22.00 the deduction is dollar value -15%-$1.81 and when the product is under $16.50 the deduction is dollar value -24%-.32cents.I am new to code writing and need help thankyou barry t
•
•
•
•
$16.50 the deduction is dollar value -24%-.32cents.I am new to code writing and need help thankyou barry t
-T
BTW welcome to daniweb
Firefox
Ewido
Tune up windows
Get detailed system information
My Fixes
Member - Alliance of Security Analysis Professionals - Since 2006
Ewido
Tune up windows
Get detailed system information
My Fixes
Member - Alliance of Security Analysis Professionals - Since 2006
•
•
Join Date: Jul 2005
Posts: 483
Reputation:
Solved Threads: 19
I'm assuming you meant 22.00 OR Great and 16.50 OR Greater
C# Syntax (Toggle Plain Text)
double valueAfterDeduction(double oldValue){ if(oldValue >= 22.00) oldValue -= 3.3; else if(oldValue >= 16.5) oldValue = (oldValue * .85) - 1.81; else oldValue = (oldValue * .76) - .32; return oldValue; }
•
•
Join Date: Mar 2005
Posts: 10
Reputation:
Solved Threads: 0
double Price, Rate, Amount, Deductions, NetPrice;
Price = double.Parse(txtPrice.Text);
Rate = double.Parse(txtRate.Text);
Deductions = double.Parse(txtDeductions.Text);
Amount = (Price >= 22.00 - 3.30);
if(Price >= 16.5)Price = (Price * .85)-1.81;
else Price = (Price * .76)-.32;
NetPrice = Price - Amount - Deductions;
txtAmount.Text = Amount.ToString("C");
txtNetPrice.Text = NetPrice.ToString("C");
Price = double.Parse(txtPrice.Text);
Rate = double.Parse(txtRate.Text);
Deductions = double.Parse(txtDeductions.Text);
Amount = (Price >= 22.00 - 3.30);
if(Price >= 16.5)Price = (Price * .85)-1.81;
else Price = (Price * .76)-.32;
NetPrice = Price - Amount - Deductions;
txtAmount.Text = Amount.ToString("C");
txtNetPrice.Text = NetPrice.ToString("C");
•
•
Join Date: Jul 2005
Posts: 483
Reputation:
Solved Threads: 19
ok, now I am completely confused. What are you trying to do? What is the Amount variable supposed to represent? What is the rate? You read that in but never use it. And is the user supposed to set his own deductions? I thought that was set.
Anyway, based on your original question and this code i would do the following, but, to be honest, I'm not really sure what you want.
Anyway, based on your original question and this code i would do the following, but, to be honest, I'm not really sure what you want.
C# Syntax (Toggle Plain Text)
double Price, Rate, Amount, Deductions, NetPrice; Price = double.Parse(txtPrice.Text); Rate = double.Parse(txtRate.Text); Deductions = double.Parse(txtDeductions.Text); if(Price >= 22.00) Price = Price - 3.30); else if(Price >= 16.5)Price = (Price * .85)-1.81; else Price = (Price * .76)-.32; //txtAmount.Text = Amount.ToString("C"); commented this line out because I don't know what you want here. txtNetPrice.Text = Price.ToString("C");
![]() |
Similar Threads
Other Threads in the C# Forum
- Previous Thread: C# PDA programming
- Next Thread: Printing text to printer; PosPrinter class information
Views: 3061 | Replies: 6
| Thread Tools | Search this Thread |
Tag cloud for C#
.net access ado.net algorithm array barchart bitmap box broadcast button buttons c# chat check checkbox class client code combobox control conversion csharp custom database datagrid datagridview dataset datetime degrees development draganddrop drawing encryption enum event excel file files form format forms ftp function gdi+ http httpwebrequest image index input install label list listbox listener login mandelbrot math mouseclick mysql networking operator oracle path photoshop picturebox pixelinversion prime programming radians regex remote remoting resource richtextbox save saving serialization server socket sql statistics stream string table tcp text textbox time timer treeview update usercontrol validation view visualstudio webbrowser windows winforms wpf xml






