Price Calculations

Please support our C# advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Mar 2005
Posts: 10
Reputation: barry t is an unknown quantity at this point 
Solved Threads: 0
barry t barry t is offline Offline
Newbie Poster

Price Calculations

 
0
  #1
Nov 7th, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 1,542
Reputation: tayspen is on a distinguished road 
Solved Threads: 98
Team Colleague
tayspen's Avatar
tayspen tayspen is offline Offline
<Insert title here>

Re: Price Calculations

 
0
  #2
Nov 7th, 2005
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
So wait is that saying when the price in under/over the value you subtract 24% the subract .32 cents for that #?

-T

BTW welcome to daniweb
Firefox
Ewido
Tune up windows
Get detailed system information
My Fixes

Member - Alliance of Security Analysis Professionals - Since 2006
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 10
Reputation: barry t is an unknown quantity at this point 
Solved Threads: 0
barry t barry t is offline Offline
Newbie Poster

Re: Price Calculations

 
0
  #3
Nov 7th, 2005
yes when the dollar value is under $16.50 the deduction is - 24% - 32cents = net value
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 483
Reputation: campkev is an unknown quantity at this point 
Solved Threads: 19
campkev campkev is offline Offline
Posting Pro in Training

Re: Price Calculations

 
1
  #4
Nov 8th, 2005
I'm assuming you meant 22.00 OR Great and 16.50 OR Greater
  1. double valueAfterDeduction(double oldValue){
  2. if(oldValue >= 22.00) oldValue -= 3.3;
  3. else if(oldValue >= 16.5) oldValue = (oldValue * .85) - 1.81;
  4. else oldValue = (oldValue * .76) - .32;
  5. return oldValue;
  6. }
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 10
Reputation: barry t is an unknown quantity at this point 
Solved Threads: 0
barry t barry t is offline Offline
Newbie Poster

Re: Price Calculations

 
0
  #5
Nov 8th, 2005
thankyou campkev I will try your code thankyou for your help barry t
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 10
Reputation: barry t is an unknown quantity at this point 
Solved Threads: 0
barry t barry t is offline Offline
Newbie Poster

Re: Price Calculations

 
0
  #6
Nov 10th, 2005
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");
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 483
Reputation: campkev is an unknown quantity at this point 
Solved Threads: 19
campkev campkev is offline Offline
Posting Pro in Training

Re: Price Calculations

 
0
  #7
Nov 10th, 2005
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.


  1. double Price, Rate, Amount, Deductions, NetPrice;
  2.  
  3. Price = double.Parse(txtPrice.Text);
  4. Rate = double.Parse(txtRate.Text);
  5. Deductions = double.Parse(txtDeductions.Text);
  6.  
  7. if(Price >= 22.00) Price = Price - 3.30);
  8. else if(Price >= 16.5)Price = (Price * .85)-1.81;
  9. else Price = (Price * .76)-.32;
  10.  
  11.  
  12. //txtAmount.Text = Amount.ToString("C"); commented this line out because I don't know what you want here.
  13. txtNetPrice.Text = Price.ToString("C");
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 3061 | Replies: 6
Thread Tools Search this Thread



Tag cloud for C#
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC