' RightTriangle compute area and hypotenuse of a right triangle' this routine contains examples of Cache Basic features */SubRun()println"Compute the area and hypotenuse of a right triangle"println"given the lengths of its two sides."printlnprintln"First, choose a unit of measurement. "input"(i)nches, (f)eet, (m)iles, "_,"(c)entimeters, m(e)ters, (k)ilometers: ",unitsprintln' translate units to a full wordselectcaseleft(units,1)case"i"units="inches"case"f"units="feet"case"m"units="miles"case"c"units="centimeters"case"e"units="meters"case"k"units="kilometers"caseelseunits="units"endselectdoprintlninput"Length of side 1: ",side1if(side1)=""thenexitdoloopwhileIsNegative(side1)if(side1="")thenexitsubdoprintlninput"Length of side 2: ",side2if(side2)=""thenexitdoloopwhileIsNegative(side2)if(side2="")thenexitsubCompute(units,side1,side2)endsubpublicfunctionIsNegative(ByValnumAs%String)As%Boolean' is num negative?' check in range "1" through "9"if(num<chr(49))or(num>chr(57))thenprint" Enter a positive number."returnTrueelseprint" Accepted."returnFalseendifendfunctionprivatefunctionCompute(ByValunitsAs%String,_ByValAAs%Integer,_ByValBAs%Integer)' compute and display area and hypotenusearea=round(((A*B)/2),2)hypot=round(sqr((A^2)+(B^2)),2)println:printlnprintln"The area of this triangle is ",area," square ",units,"."printlnprintln"The hypotenuse is ",hypot," ",units,"."endfunction