Math Is Fun Forum
  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 2005-02-16 13:55:26

rabid
Guest

Please help me

hey ya,

I really hate maths lol, ok here’s my problem

I have a variable know as PriceOfProperty
I have another variable known as Deposit

Both variables can be any number as they are set by a user input

I need to ensure that what ever the PriceOfProperty the Deposit is at least 5% of that value

It has to be in the format of an if statement like so:

If the Deposit value is 5 % of PriceOfProperty value then true

Only its actual syntax is in this format:

If (txtPriceOfProperty.Text / 100) * 5 > …. Then

Only that sum doesn’t work as that now how you work it out

Any help would be appreciated

Cheers
Rabid Lemming

#2 2005-02-16 15:40:13

MathsIsFun
Administrator
Registered: 2005-01-21
Posts: 7,534

Re: Please help me

Hi Rabid, is the language Visual Basic?

Perhaps the problem is that the value is text, not numeric. Try converting it first. In VB you could use CDbl().

Also try showing the numbers before and after the calculation (debug.print or msgbox or whatver works to show them on the screen) to see what is going on.

It is also possible that when dividing by 100 it is thinking "this is a whole number, so the answer should be a whole number".

Try this:

MinDeposit = cdbl(txtPriceOfProperty.Text) * 0.05
if (Deposit >= MinDeposit) then
...
end if

Let's know how you get on


"The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  - Leon M. Lederman

Offline

#3 2005-02-18 02:04:12

rabid
Guest

Re: Please help me

hi,

Cheers that helped a lot I got it working using:

Dim var10 As Decimal
Dim var11 As Decimal
'Get 5% of the house price as a decimal number
var10 = (txtPriceOfProperty.Text / 100) * 5
'Get the deposit as a decimal
var11 = txtDeposit.Text
'Check the depositis grater then the asking amount
If (var11 >= var10) Then
CheckDepostit = True
Else
CheckDepostit = False
End If

Thank you for your help

Cheers
Rabid Lemming

#4 2013-05-29 00:40:16

ShivamS
Member
Registered: 2011-02-07
Posts: 3,467

Re: Please help me

What is that?

Offline

#5 2013-05-29 01:53:37

Agnishom
Real Member
From: The Complex Plane
Registered: 2011-01-29
Posts: 15,375
Website

Re: Please help me

Visual Basic Program


'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
'Humanity is still kept intact. It remains within.' -Alokananda

Offline

#6 2013-05-29 01:55:15

ShivamS
Member
Registered: 2011-02-07
Posts: 3,467

Re: Please help me

No, there was another post by a guest today on this thread which was composed of weird symbols only.

Offline

#7 2013-05-29 02:10:57

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 83,251

Re: Please help me

That got deleted, he is a vandal.


In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

Board footer

Powered by FluxBB