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>
For example 1.8 + 1.9 = 3.1 (1 Pound 8 ounces + 1 Pound 9 ounces)<BR><BR> <BR>
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.
Yes it's messy, and bloated, but it'll give you the general idea on how to get the job done.<BR><BR><%<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 > 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>%>
took you 40 min to come up with that<BR><BR>:p<BR><BR>
Less than 5. I waited until I was bored. BTW...It's still buggy. It doesn't like a 10 for ounces.
it would have taken you 20 min to figure the logic...you being slow and all :p<BR><BR>