i am writing a small piece of code in vb.net which will convert grams to tola masha and ratti respectively.
i can convert grams into number of tolas by number of grams divided by 12.5 but further i am stuck. here are some clues
1 tola = 12 masha
1 masha= 8 ratti
while in grams
1 tola=12.5grams.
grams to tola masha and ratti conversion
Page 1 of 17 Replies  11110 Views  Last Post: 22 May 2013  12:11 PM
Replies To: grams to tola masha and ratti conversion
#2
Re: grams to tola masha and ratti conversion
Posted 22 May 2013  12:18 AM
It just simple maths
If i have 24 masha how many tola is that?
How many ratti do you need to make 1 tola?
If i have 24 masha how many tola is that?
How many ratti do you need to make 1 tola?
#3
Re: grams to tola masha and ratti conversion
Posted 22 May 2013  12:30 AM
Yeah. i Even think this is a simple calculation.
Quote
for tola
suppose
2 tola = 2 *12.5g = 30gram
1gram = (2/30) or (1/12.5) tola
for masha
suppose
1 masha = (1/12)*1*12.5 = approx (1.041)gram
1 gram = (1/1.041)masha
fo ratti
1 ratti = (1/8)*(1/12)*1*12.5 = approx 0.13 gram
or 1 ratti = 1*(1.041/8) = .13 gram
1 gram = (1/.13)ratti
put them in different button click event.
suppose
2 tola = 2 *12.5g = 30gram
1gram = (2/30) or (1/12.5) tola
for masha
suppose
1 masha = (1/12)*1*12.5 = approx (1.041)gram
1 gram = (1/1.041)masha
fo ratti
1 ratti = (1/8)*(1/12)*1*12.5 = approx 0.13 gram
or 1 ratti = 1*(1.041/8) = .13 gram
1 gram = (1/.13)ratti
put them in different button click event.
This post has been edited by xlogan: 22 May 2013  12:44 AM
#4
Re: grams to tola masha and ratti conversion
Posted 22 May 2013  01:08 AM
xlogan, on 22 May 2013  12:30 AM, said:
Yeah. i Even think this is a simple calculation.
Quote
for tola
suppose
2 tola = 2 *12.5g = 30gram
1gram = (2/30) or (1/12.5) tola
for masha
suppose
1 masha = (1/12)*1*12.5 = approx (1.041)gram
1 gram = (1/1.041)masha
fo ratti
1 ratti = (1/8)*(1/12)*1*12.5 = approx 0.13 gram
or 1 ratti = 1*(1.041/8) = .13 gram
1 gram = (1/.13)ratti
put them in different button click event.
suppose
2 tola = 2 *12.5g = 30gram
1gram = (2/30) or (1/12.5) tola
for masha
suppose
1 masha = (1/12)*1*12.5 = approx (1.041)gram
1 gram = (1/1.041)masha
fo ratti
1 ratti = (1/8)*(1/12)*1*12.5 = approx 0.13 gram
or 1 ratti = 1*(1.041/8) = .13 gram
1 gram = (1/.13)ratti
put them in different button click event.
#5
Re: grams to tola masha and ratti conversion
Posted 22 May 2013  01:14 AM
xlogan, on 22 May 2013  12:30 AM, said:
Yeah. i Even think this is a simple calculation.
Quote
for tola
suppose
2 tola = 2 *12.5g = 30gram
1gram = (2/30) or (1/12.5) tola
for masha
suppose
1 masha = (1/12)*1*12.5 = approx (1.041)gram
1 gram = (1/1.041)masha
fo ratti
1 ratti = (1/8)*(1/12)*1*12.5 = approx 0.13 gram
or 1 ratti = 1*(1.041/8) = .13 gram
1 gram = (1/.13)ratti
put them in different button click event.
suppose
2 tola = 2 *12.5g = 30gram
1gram = (2/30) or (1/12.5) tola
for masha
suppose
1 masha = (1/12)*1*12.5 = approx (1.041)gram
1 gram = (1/1.041)masha
fo ratti
1 ratti = (1/8)*(1/12)*1*12.5 = approx 0.13 gram
or 1 ratti = 1*(1.041/8) = .13 gram
1 gram = (1/.13)ratti
put them in different button click event.
well i have correct a small mistake in calculation. thanks for the idea. actually i have a text box in which client will input the number of grams. suppose the gold weighs 111 grams. now i want to converts this weight into tola masha and ratti.
for tola: 111\12.5
i will get only the integral part that is 8. means 8 tolas.
for masha and ratti: i have remaining 11 grams now thats what in which i am stuck. i a single click he will know how much tolas mashas and rattis 111gram have.
#6
Re: grams to tola masha and ratti conversion
Posted 22 May 2013  02:38 AM
okay i got you.
take six textboxes and one button. this is simplest way. you can do much better. this is just an idea how calculation goes.
1. for input(grams)
2. for tola
3. for masha
4. for ratti
5. for ist remainder
6. for 2nd remainder
take six textboxes and one button. this is simplest way. you can do much better. this is just an idea how calculation goes.
1. for input(grams)
2. for tola
3. for masha
4. for ratti
5. for ist remainder
6. for 2nd remainder
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Try TextBox2.Text = Math.Truncate(TextBox1.Text / 12.5) ' this will gives you tola in (textbox2) TextBox5.Text = (TextBox1.Text Mod 12.5) ' ist remainder TextBox6.Text = (TextBox5.Text Mod 1.0417) ' 2nd remainder TextBox3.Text = Math.Truncate(TextBox5.Text / 1.0417) ' this will gives you masha in (textbox3) TextBox4.Text = Math.Truncate(TextBox6.Text / 0.13) ' this will gives you masha in (textbox4) Catch End Try End Sub
#7
Re: grams to tola masha and ratti conversion
Posted 22 May 2013  02:58 AM
maths.truncate will do the Job
The above code working for me.
But I will suggest you to use variables instead of taking too many textboxes. for example textbox5 as A, textbox6 As B,
The above code working for me.
But I will suggest you to use variables instead of taking too many textboxes. for example textbox5 as A, textbox6 As B,
Dim A, B As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Try TextBox2.Text = Math.Truncate(TextBox1.Text / 12.5) ' this will gives you tola in (textbox2) A = (TextBox1.Text Mod 12.5) ' ist remainder B = (A Mod 1.0417) ' 2nd remainder TextBox3.Text = Math.Truncate(A / 1.0417) ' this will gives you masha in (textbox3) TextBox4.Text = Math.Truncate(B / 0.13) ' this will gives you Ratti in (textbox4) Catch End Try
This post has been edited by kai_itz me: 22 May 2013  03:21 AM
#8
Re: grams to tola masha and ratti conversion
Posted 22 May 2013  12:11 PM
thank u so much guys. that work like charm.
Page 1 of 1
