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

You are not logged in.

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

rabid
Guest

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
Registered: 2005-01-21
Posts: 7,555

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

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

Cheers
Rabid Lemming

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

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

What is that?

Offline

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

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

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'
'You have made another human being happy. There is no greater accomplishment.' -bobbym

Offline

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

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

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
From: Bumpkinland
Registered: 2009-04-12
Posts: 90,791

That got deleted, he is a vandal.

In mathematics, you don't understand things. You just get used to them.

I agree with you regarding the satisfaction and importance of actually computing some numbers. I can't tell you how often I see time and money wasted because someone didn't bother to run the numbers.

Offline