CIT 042 Index > Scalars

Programming Assignment
Scalars

Read everything before doing anything!

Your program will do the following:

Your program must use strict; You must eliminate the trailing newline character at the end of all user input.

Here is a sample run of the program. User input is shown in red and bold. Your output must look exactly like this (of course, the name and numbers will differ depending upon user input).

Enter your name: Moishe Pipik
Enter your height in feet and inches.
First, the feet: 5
Now, the inches: 4
Finally, your weight in pounds: 135
Moishe Pipik, your height is 5'4" (162 cm).
You weigh 135 pounds (61 kg).
Your body mass index is 23.73046875.

Hint

To truncate a value to an integer, use the built-in int operator. Try the following Perl program and see what it produces.

#!/usr/bin/perl
use strict;

my $x = 19;
my $y = 4;
my $z;
my $z_truncated;
$z = $x / $y;
print $z, "\n";
print int($z), "\n";
$z_truncated = int($z);
print $z_truncated, "\n";

When you finish

Name the file in the form lastname_firstname_scalars.pl and email it to the instructor. So, if your name is Janine Smith, your filename would be smith_janine_scalars.pl. The filename must be all lowercase, and may not contain blanks. If your file is not named correctly, I will not grade it.