How can i add Pounds and Ounces?

1. SRT
Junior Member
Join Date
Dec 1969
Posts
3

## How can i add Pounds and Ounces?

Any suggestions on adding pounds and ounces<BR>For example 1.8 + 1.8 = 3.1 (1 Pound 8 ounces + 1 Pound 9 ounces)<BR>

2. SRT
Junior Member
Join Date
Dec 1969
Posts
3

## Updated wrong Example

For example 1.8 + 1.9 = 3.1 (1 Pound 8 ounces + 1 Pound 9 ounces)<BR><BR> <BR>

3. Senior Member
Join Date
Dec 1969
Posts
10,852

## Hmmm.....

Do a split on the period. Multiply the first half by 16. Add that to the second half. Divide by sixteen. The integer is the pounds, and the Mod is the ounces.

4. Senior Member
Join Date
Dec 1969
Posts
10,852

## Like this.....

Yes it&#039;s messy, and bloated, but it&#039;ll give you the general idea on how to get the job done.<BR><BR>&#060;%<BR>weight = Request.Form("input1")<BR>newweight = Split(weight, ".",2,1)<BR>pounds = newweight(0) * 16<BR>ounces = newweight(1)<BR><BR>total = pounds + ounces<BR>poundsint = total / 16<BR>newpounds = int(poundsint)<BR>newounces = total Mod 16<BR>Response.Write "Pounds: " & newpounds & " Ounces: " & newounces & "<BR>"<BR><BR>weight1 = Request.Form("input2")<BR>newweight1 = Split(weight1, ".",2,1)<BR>pounds1 = newweight1(0) * 16<BR>ounces1 = newweight1(1)<BR><BR>total1 = pounds1 + ounces1<BR>poundsint1 = total1 / 16<BR>newpounds1 = int(poundsint1)<BR>newounces1 = total1 Mod 16<BR>Response.Write "Pounds: " & newpounds1 & " Ounces: " & newounces1 & "<BR>"<BR><BR>If newounces + newounces1 &#062; 15 Then<BR>totalpounds = (newpounds + newpounds1 + 1)<BR>totalounces = (newounces + newounces1 - 16)<BR>Else<BR>totalounces = (newounces + newounces1)<BR>totalpounds = (newpounds + newpounds1)<BR>End If<BR><BR>Response.Write "Total Pounds: " & totalpounds & " Total Ounces: " & totalounces<BR>%&#062;

5. Senior Member
Join Date
Dec 1969
Location
Los Angeles, CA
Posts
21,192

## Slow "typer" eh!!

took you 40 min to come up with that<BR><BR>:p<BR><BR>

6. Senior Member
Join Date
Dec 1969
Posts
10,852

## Actually....

Less than 5. I waited until I was bored. BTW...It&#039;s still buggy. It doesn&#039;t like a 10 for ounces.

7. Senior Member
Join Date
Dec 1969
Location
Los Angeles, CA
Posts
21,192

## Less than 5 my ***

it would have taken you 20 min to figure the logic...you being slow and all :p<BR><BR>

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•