Lab - 5 Manual
Lab - 5 Manual
Lab - 5 Manual
Lab Requirements
PyCharm (IDE).
Version 1.1
09/10/2019
Practice Activities with Lab Instructor (20 minutes)
Write a program that prompts the user to enter the length from the center of a pentagon
to a vertex and computes the area of the pentagon, as shown in the following figure.
√
The formula for computing the area of a pentagon is , where s is the length
of a side. The side can be computed using the formula , where r is the length
from the center of a pentagon to a vertex.
Solution
Write a program that reads the following information and prints a payroll statement:
Employee’s name (e.g., Smith)
Number of hours worked in a week (e.g., 10)
Hourly pay rate (e.g., 9.75)
Federal tax withholding rate (e.g., 20%)
State tax withholding rate (e.g., 9%)
A sample run is shown below:
3
Solution
5
Individual Activities (60 minutes)
The area of a pentagon can be computed using the following formula (s is the length of a
side):
( )
Write a program that prompts the user to enter the side of a pentagon and displays the
area. Here is a sample run:
Write a program that prompts the user to enter a four-digit integer and displays the
number in reverse order. Here is a sample run:
6
Extra Exercises (Homework)