Click here to Skip to main content
15,888,113 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
sorry for my poor english.
I input weight at UI, as 0.500
then i get amount as 40.
after weight 0.500, means from 0.501 it should give me result Amount as 55 for upto the weight 1.000.
From weight 1.001 it should return me amount as 110 upto 1.500
like wise,

weight Amount
for 1.001 to 1.500 110
for 1.501 to 2.000 165
for 2.001 to 3.000 220

and so on


How can i implement it in c#
Posted
Comments
Thanks7872 22-Oct-13 8:21am    
Not at all clear what are you talking about. I am not talking about English,but mention what is your requirement,the code,and the output.
phil.o 22-Oct-13 9:21am    

1 solution

Hello,
Plz try this.
    decimal amt=0;
    decimal weight=Convert.ToDecimal(txtWeight.Text);
    if(weight<=0.500)
       amt=40;
    else if (weight>=0.501 && weight<=1.000)
       amt=55;
    else if (weight>=1.001 && weight<=1.500)
       amt=110;
    else if (weight>=1.501 && weight<=2.000)
       amt=165;
    else if (weight>=2.001 && weight<=3.000)
       amt=220;

//use amt variable in your further code
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900