Subroutines #3

 

1)      Create a procedure that takes 1 parameter, the parametert will be a person’s height in cm.  The procedure will convert the person’s height from metric to imperial and output to the screen. For example: (you can round the inches).

 

var metHeight:int:168

 

changeHeight(metHeight)

 

output = 5 foot 5 inches

 

 

2)   Create a function to calculate a baseball player’s slugging percentage.  In baseball statistics, slugging percentage (SLG) is a measure of the power of a hitter. It is calculated as total bases divided by at bats. Total bases can be calculated from commonly used baseball statistics by using the formula TB = 1B + (2*2B) + (3*3B) + (4*HR).  The function will take 5 parameters The first four will be the number of singles(1B), doubles(2B), triples(3B), HR, respectively(in that order). The final parameter will be the number of at bats(plate appearances).  The function will result the slugging percentage.