Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Need help with a Calculation

Well im making a calculator but i want to put this into my calculator
1=0.25
2or3=0.50
4or5=0.75
6or7=1.00
8or9=1.25
10o11=1.50
12or13=1.75
14or15=2.00
16or17=2.25
18or19=2.50
20or21=2.75
22or23=3.00
24or25=3.25
26or27=3.50

and all the way up to
98or99=12.25

Hope you understand and would like this code alot to finish my calculator
[410 byte] By [kingbeattie] at [2007-11-11 7:41:09]
# 1 Re: Need help with a Calculation
Not sure i understand... so you want when you input 26 or 27 to get 3.5?

Here's some pseudocode:

if number is odd
result = number - 1
end if
result = (result / 2.0 * .25) + .25;
destin at 2007-11-11 17:26:40 >
# 2 Re: Need help with a Calculation
ill try this and reply i
kingbeattie at 2007-11-11 17:27:40 >
# 3 Re: Need help with a Calculation
this is what i got
Option Explicit

Private Sub Command1_click()
Dim firstNumber As Integer
Dim secondNumber As Integer
Dim thirdNumber As Integer
Dim forthNumber As Integer
Dim fithNumber As Integer
Dim Result As Integer
firstNumber = Attack.Text * 0.325
secondNumber = Strenght.Text * 0.325
thirdNumber = Deffence.Text / 4
forthNumber = Hits.Text / 4
fithNumber = Prayer.Text * 0.25
Result = firstNumber + secondNumber + thirdNumber + forthNumber + fithNumber
Text1.Text = Result
End Sub

and what i want is instead of prayer.text *0.25 i want it to go up and extra 0.25 every even number and still be same for lower odd number than it
kingbeattie at 2007-11-11 17:28:39 >
# 4 Re: Need help with a Calculation
i think you answer would work but i dont know where to put it into my code could you posibly put it in for me, thanks for helping
kingbeattie at 2007-11-11 17:29:44 >
# 5 Re: Need help with a Calculation
I probably would help you there, but I really only know Java and C/C++ :D
destin at 2007-11-11 17:30:42 >
# 6 Re: Need help with a Calculation
Try this:

fifthNumber = ((Prayer.Text \ 2) + 1) * 0.25
Phil Weber at 2007-11-11 17:31:38 >
# 7 Re: Need help with a Calculation
its alittle off,

Is thier a calculation i can use so that prayer.text would multiply only on even numbers and stay same as previous even number when it is odd? i realy need this its a vital calculation
kingbeattie at 2007-11-11 17:32:42 >
# 8 Re: Need help with a Calculation
what i want is,

if Prayer.text = odd then - 1 then *0.25
If Prayer.text = Even *0.25

I want a code that would do that i know what i typed probly isnt even code but it says what i want
kingbeattie at 2007-11-11 17:33:45 >
# 9 Re: Need help with a Calculation
ive fixed this problem but now i got anoughter :(
VB seems to be rounding up or down my numbers is thier neway of stoping this?
kingbeattie at 2007-11-11 17:34:42 >
# 10 Re: Need help with a Calculation
Please post your code.
Phil Weber at 2007-11-11 17:35:43 >
# 11 Re: Need help with a Calculation
i worked it out i had As FirstNumber interget But i changed that and now it works thank you for all your help
kingbeattie at 2007-11-11 17:36:41 >