[Tutor] small program in Python and in C++

Rob rob@uselesspython.com
Wed, 03 Jul 2002 05:35:21 -0500


This is a multi-part message in MIME format.
--------------090004050406070600090609
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Looks like my hombre did indeed create a PHP version of the obesity 
calculator. It's attached here.

Rob
http://uselesspython.com
-- 
"Giving the Linus Torvalds Award to the Free Software Foundation is a 
bit like giving the Han Solo Award to the Rebel Alliance."
--Richard Stallman at the 1999 LinuxWorld show

--------------090004050406070600090609
Content-Type: text/plain;
 name="obesity.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="obesity.txt"

<html>
<head>
<title>
Body Mass Index -- Are you obese???
</title>
</head>
<body>

<?php

# Let's get right down to it...

if($action == "Calculate!") {
  $bodyMassTarget=30;
  $height=($inches + ($feet * 12));
  $bodyMassIndex = 703 * ($mass / ($height * $height));
  echo "The target body mass index is ".$bodyMassTarget.". Your body mass index is ".$bodyMassIndex.". <br /><br />";
  if($bodyMassIndex >= $bodyMassTarget) {
    $obesity="I'm sorry. You are obese.";
  } else {
    $obesity="Congratulations! You are not obese!";
  }
  echo $obesity;
} else {

?>

<form action="./obesity.php" method="post">
<b>Height:&nbsp;</b><input type="text" size="1" maxlength="1" name="feet">FT&nbsp;<input type="text" size="1" maxlength="2" name="inches">IN<br />
<b>Weight:&nbsp;</b><input type="text" size="2" maxlength="3" name="mass">LB's<br />
<input type="submit" name="action" value="Calculate!">
</form>
<?php

}

?>

</body>
</html>
--------------090004050406070600090609--