0% found this document useful (0 votes)
42 views3 pages

Chapter 3 AProg Ex

This document provides instructions for a programming exercise asking students to write a program that calculates a rider's height in inches from their height in feet and inches, determines if they meet the minimum height requirement of 51 inches to ride a ride at Universal Studios, and displays an appropriate message. The instructions give the algorithm, outline the steps to set up and write the program following coding standards, and provide test data to use. Students are asked to upload their Python code file and a Word file with a screenshot of their code and output.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views3 pages

Chapter 3 AProg Ex

This document provides instructions for a programming exercise asking students to write a program that calculates a rider's height in inches from their height in feet and inches, determines if they meet the minimum height requirement of 51 inches to ride a ride at Universal Studios, and displays an appropriate message. The instructions give the algorithm, outline the steps to set up and write the program following coding standards, and provide test data to use. Students are asked to upload their Python code file and a Word file with a screenshot of their code and output.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

PROGRAMMING EXERCISE: Chapter 3A– from sections 3.1 – 3.

This assignment assumes that you have read and studied Chapter 3, sections 3.1 – 3.3 in the class textbook
and completed all example exercises. It is also assumed that you have viewed and studied all CLASS
MATERIALS items found in this week’s module.

One of the most thrilling and popular rides at Universal Studios is the Hollywood Rip Ride Rockit. To ensure the
safety of this ride, a rider must be at least 51” in height. Write a program that calculates a rider’s height in
inches when their height in feet and inches is entered. Once the height is calculated in inches, the program
determines if the rider is tall enough to ride and displays an appropriate message.

The algorithm for this program is:


1. Get the rider’s height in feet and inches
2. Calculate height in inches
3. Determine if the rider is tall enough
4. Display an appropriate message to the rider

1. For Programming Exercise:


a. Open template.py (located in your CS101 Assignment folder) and Save As ridejsmith.py
(change jsmith to your first name initial and last name)
b. Modify comment lines 1 – 4 with your information and a descriptive program purpose
c. Beginning in line 6, write code to produce the output below. Be sure to follow CS101 Coding
Standards.
d. Use variables to store data that is input by the program user and read from the keyboard.
e. Use constants for data that does not change during program execution.
f. Construct the variable names using the underscore name separator method (snake case).
(pay_rate total_pay days_in_month pet_name)
g. Construct the constant names using ALL uppercase letters, separating words with the
underscore. (TAX_RATE BIG_NUMBER SHIP_RATE)
h. Use comments to identify the program code blocks
• Program introduction
• Variable declaration and initialization
• Constant declaration and initialization
• Input
• Process
• Output
FYI – the textbook often overuses comments to better explain what each line or small
section of code does for better student understanding and learning. When you write
code, use in-line and small-block comments sparingly and only when absolutely needed.
i. Use:
• a constant for the required height
• f formatting to display the rider’s height in inches
• only one if-else structure to determine if the rider is tall enough to ride and to then
display the appropriate messages
j. Save and Run the program. (Use the following as your test data.) Your output should look like
the image below. Be sure to test your program with the same values.
k. Use the TEST DATA displayed below. Your output displayed in the Python IDLE Shell when the
program is run with the TEST DATA should be:

a. Correct any coding errors and test and Save until output is correct and is exactly the same as
above
2. Open the assignmentTemplate.docx
3. Save As PEC3A_FirstinitialLastname.docx (example PEC3A_JSmith.docx) into your CS101 Assignments
folder
4. Add your first and last name to the top, in the first line of this Word document
5. Do a screenshot of your code and output (be sure both the Editor window and IDLE Shell are completely
visible in your screenshot – cover your entire window – no background showing). The screenshot must
also include the date and time displayed in the bottom right corner of your computer screen.
6. Paste your screenshot directly under your name that you just entered in the
PEC3A_FirstinitialLastname.docx document in Step 4.
7. Save the PEC3A_FirstinitialLastname.docx and upload to this assignment drop area for grading
8. You will also upload one .py file:
• ridejsmith.py
There are 2 file uploads total for this assignment!!

FYI-Pay close attention to the details found in this assignment spec to earn all possible points. Also, remember
to replace “jsmith” with your firstinitiallastname. This is so that I always know whose assignment I’m
grading!!
Line numbers must be displayed in Editor window to earn all assignment points!!
****The assignmentTemplate.docx allows you to paste a full-size screenshot, so DO NOT resize screenshot to
be smaller!!

You might also like