117 Homework Assignment #3 (5 pts)

Write a perl program to do the following:

   - prompt the user for the height of a rectangle
     and assign the value that was input to a variable.

   - prompt the user for the width of that rectangle
     and assign the value that was input to another variable.

   - Do not check if the input is reasonable,
     i.e. only use reasonable values in your testing.
     e.g. no zero or negative numbers.

   - calculate the perimeter of the rectangle
      by adding the height and width
       and then multiple their sum by 2.
        You must use both addition and multiplication
         in your calculation
          or there will be a deduction.
     Hint: you will get the wrong answer
      if you don't use precedence properly.

   - when you display the result, follow this example:

A rectangle of height 7.8 and width 4.3 has perimeter: 24.2

   - I will deduct points if your output could be made
     closer to the example I provided
     while using the values input by the user.

   - For example, note the full result is displayed on one line.
     If your output is on multiple lines, that is a deduction.

   - Note that the output begins with these 4 words: A rectangle of height
     If your output begins differently, that is a deduction.
     Note there is only one capital letter in those 4 words.

   - There will be a deduction for each spelling error. Programs with
     bad spelling and bad grammar reflect badly on the company you work
     for.

   - Note that nowhere in the example are two spaces output
     next to each other i.e. single spaces only.

   - Do not modify the perimeter as perl calculates it,
     i.e. do not add or remove digits after the decimal point.

Other program requirements:

   - Use descriptive variable names
     e.g. $h and $w do not tell someone reading your code how those
      variables are being used.

   - make sure your first line is
#!/usr/bin/perl

   - If you enter 7.8 for the height and 4.3 for the width,
     make sure your program calculates 24.2 for the perimeter.

To get credit for this homework:

   - Run your program in the classroom at your station.
   - Ask the instructor to come over and see that it ran.
   - The instructor will then ask you to run it again,
      and will give you specific values for height and width
       to enter.
   - If you get the right answer,
      the instructor will ask you to display your source code.
   - Any deductions can be viewed on the class web site under:
      View Homework
       You may make corrections and ask the instructor to
       regrade this homework unless it is past the last
       accepted date. Remember this assignment is only graded
       in class since you must demonstrate running the program.
   - Strategy: the earlier you finish this assignment,
      the more times you can make corrections
       and ask for it to be graded again
        to improve your score.