CSC121 Python Programming: Lab 01 - Designing and Executing Algorithms
VerifiedAdded on 2019/09/16
|5
|1646
|721
Homework Assignment
AI Summary
This document presents a comprehensive solution to CSC121 Lab 01, focusing on algorithm design for computer programs. The assignment requires students to design algorithms that include input, processing, and output steps for five different problems. Each problem involves creating a pseudocode algorithm and a variable table demonstrating the step-by-step execution with specific test cases. The problems cover various scenarios, including calculating conditioner needs for fish tanks, managing employee retirement contributions, processing jacket discounts, calculating the total cost of pizza and soda orders, and determining the total training fees for employees attending different training parts. The solutions meticulously detail each step of the algorithms, providing clear variable tables to track value changes, ensuring a thorough understanding of algorithm execution and program design principles.

_______________________________________________________________________
CSC121 PYTHON PROGRAMMING
_______________________________________________________________________
LAB 01 DESIGNING ALGORITMS FOR COMPUTER PROGRAMS
OBJECTIVES
In this lab assignment, students will learn:
- How to design algorithms for computer programs
- How to design steps for getting user input
- How to design steps for processing
- How to design steps for displaying output
- How to execute steps by hand and keep track of value changes in variables
GOALS
In this lab assignment, students will demonstrate the abilities to:
- Design algorithms for computer programs
- Design steps for getting user input
- Design steps for processing
- Design steps for displaying output
- Execute steps by hand and keep track of value changes in variables
INSTRUCTION AND PROBLEMS
There are five problems in this lab. For each problem, please do the
following:
(a) Design an algorithm for a computer program to solve the problem. All
algorithms in this lab should include input steps, processing steps (e.g.
steps performing calculations) and output steps.
(b)Execute your algorithm by hand and use a table to show value changes
of the variables with the test cases provided.
The following is an example only. You must use the format of this
example in the five programs to receive full credit.
Problem to solve:
The power of an air conditioner is measured in British Thermal Units
(BTU). The higher the BTU, the more heat the air conditioner can bring
away. When people buy an air conditioner, they need to know how many
CSC121 PYTHON PROGRAMMING
_______________________________________________________________________
LAB 01 DESIGNING ALGORITMS FOR COMPUTER PROGRAMS
OBJECTIVES
In this lab assignment, students will learn:
- How to design algorithms for computer programs
- How to design steps for getting user input
- How to design steps for processing
- How to design steps for displaying output
- How to execute steps by hand and keep track of value changes in variables
GOALS
In this lab assignment, students will demonstrate the abilities to:
- Design algorithms for computer programs
- Design steps for getting user input
- Design steps for processing
- Design steps for displaying output
- Execute steps by hand and keep track of value changes in variables
INSTRUCTION AND PROBLEMS
There are five problems in this lab. For each problem, please do the
following:
(a) Design an algorithm for a computer program to solve the problem. All
algorithms in this lab should include input steps, processing steps (e.g.
steps performing calculations) and output steps.
(b)Execute your algorithm by hand and use a table to show value changes
of the variables with the test cases provided.
The following is an example only. You must use the format of this
example in the five programs to receive full credit.
Problem to solve:
The power of an air conditioner is measured in British Thermal Units
(BTU). The higher the BTU, the more heat the air conditioner can bring
away. When people buy an air conditioner, they need to know how many
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

______________________________________________________________________________________________________________________________________________________________________________________________________________________
CSC121 Lab 01 Page 2
______________________________________________________________________________________________________________________________________________________________________________________________________________________
BTU they need to keep the room cool. Design a program to estimate how
many BTU we need when we install a window air conditioner in a room.
This number is determined by the volume of the room. The rule of thumb
is that we need 3.5 BTU per cubic foot. The program should ask the user
to enter the length, width and height of the room. It should calculate and
display the number of BTU needed for the air conditioner.
Execute your algorithm by hand with this test case: room length = 15,
room width = 11 and room height =10. Create a table to show how the
value of each variable changes during program execution.
Algorithm:
Step 1: Input the length of the room
Step 2: Input the width of the room
Step 3: Input the height of the room
Step 4: Calculate volume = length * width * height
Step 5: Calculate BTU needed = volume * 3.5
Step 6: Display BTU needed
Variable Table:
Step Room
length
Roo
m
width
Room
height
Room
volum
e
BTU
neede
d
Input room length 15
Input room width 15 11
Input room height 15 11 10
Calculate volume =
length * width * height
15 11 10 1650
Calculate BTU needed =
volume * 3.5
15 11 10 1650 5775
Display BTU needed 15 11 10 1650 5775
You need to submit an algorithm and a variable table for each problem.
Please type and save your answers for all five problems in a single Microsoft
Word document. You may copy the table from above and just modify
it for your programs. Submit the file to Blackboard for credit. The
document should be named Lab01.docx
PROBLEM 1
Mary is a big fan of tropical fish. She has a few tanks of fish at home. To
maintain a healthy environment for the fish, she needs to add conditioner to
the water once a week. The amount of conditioner added is determined by
CSC121 Lab 01 Page 2
______________________________________________________________________________________________________________________________________________________________________________________________________________________
BTU they need to keep the room cool. Design a program to estimate how
many BTU we need when we install a window air conditioner in a room.
This number is determined by the volume of the room. The rule of thumb
is that we need 3.5 BTU per cubic foot. The program should ask the user
to enter the length, width and height of the room. It should calculate and
display the number of BTU needed for the air conditioner.
Execute your algorithm by hand with this test case: room length = 15,
room width = 11 and room height =10. Create a table to show how the
value of each variable changes during program execution.
Algorithm:
Step 1: Input the length of the room
Step 2: Input the width of the room
Step 3: Input the height of the room
Step 4: Calculate volume = length * width * height
Step 5: Calculate BTU needed = volume * 3.5
Step 6: Display BTU needed
Variable Table:
Step Room
length
Roo
m
width
Room
height
Room
volum
e
BTU
neede
d
Input room length 15
Input room width 15 11
Input room height 15 11 10
Calculate volume =
length * width * height
15 11 10 1650
Calculate BTU needed =
volume * 3.5
15 11 10 1650 5775
Display BTU needed 15 11 10 1650 5775
You need to submit an algorithm and a variable table for each problem.
Please type and save your answers for all five problems in a single Microsoft
Word document. You may copy the table from above and just modify
it for your programs. Submit the file to Blackboard for credit. The
document should be named Lab01.docx
PROBLEM 1
Mary is a big fan of tropical fish. She has a few tanks of fish at home. To
maintain a healthy environment for the fish, she needs to add conditioner to
the water once a week. The amount of conditioner added is determined by

______________________________________________________________________________________________________________________________________________________________________________________________________________________
CSC121 Lab 01 Page 3
______________________________________________________________________________________________________________________________________________________________________________________________________________________
the volume of water in the tank. According to the direction on the bottle,
she has to add 1 teaspoon of conditioner per 100 cubic inches of water (or
0.01 tsp per 1 cubic inch). She wants a program to calculate the amount of
conditioner to add to each tank. All tanks are rectangular. The program will
ask the user to enter the length, width and height of the tank. It will
calculate and display the amount of conditioner to add. [Note: volume =
length * width * height]
Execute your pseudocode by hand and create a table to show how the values
of the variables change during program execution. Please use the following
test case: tank length = 20, tank width = 12 and tank height = 15.
Please type and save your answers in Lab01.docx. You may copy the
table from above and just modify it for your program.
PROBLEM 2
The retirement account of each employee in a company receives money
from two sources each month. First, each employee contributes 6% (0.06) of
his salary to his own retirement account. Second, the company also makes
a contribution equal to 3% (0.03) of the employee’s salary to the account.
For example only, suppose the monthly salary of an employee is $2000.
The employee’s own contribution will be $120, while the company’s
contribution will be $60.
They need a program to manage the retirement accounts. The user will
enter the monthly salary of an employee. The program will calculate and
display the following items: amount of money contributed by the employee
each month, amount of money contributed by the company each month,
total contribution each month (i.e. the sum of employee’s and company’s
contributions).
Execute your pseudocode by hand and create a table to show how the values
of the variables change during program execution. Please use the following
test case: monthly salary = 2000.
Please type and save your answers in Lab01.docx. You may copy the
table from above and just modify it for your program.
PROBLEM 3
CSC121 Lab 01 Page 3
______________________________________________________________________________________________________________________________________________________________________________________________________________________
the volume of water in the tank. According to the direction on the bottle,
she has to add 1 teaspoon of conditioner per 100 cubic inches of water (or
0.01 tsp per 1 cubic inch). She wants a program to calculate the amount of
conditioner to add to each tank. All tanks are rectangular. The program will
ask the user to enter the length, width and height of the tank. It will
calculate and display the amount of conditioner to add. [Note: volume =
length * width * height]
Execute your pseudocode by hand and create a table to show how the values
of the variables change during program execution. Please use the following
test case: tank length = 20, tank width = 12 and tank height = 15.
Please type and save your answers in Lab01.docx. You may copy the
table from above and just modify it for your program.
PROBLEM 2
The retirement account of each employee in a company receives money
from two sources each month. First, each employee contributes 6% (0.06) of
his salary to his own retirement account. Second, the company also makes
a contribution equal to 3% (0.03) of the employee’s salary to the account.
For example only, suppose the monthly salary of an employee is $2000.
The employee’s own contribution will be $120, while the company’s
contribution will be $60.
They need a program to manage the retirement accounts. The user will
enter the monthly salary of an employee. The program will calculate and
display the following items: amount of money contributed by the employee
each month, amount of money contributed by the company each month,
total contribution each month (i.e. the sum of employee’s and company’s
contributions).
Execute your pseudocode by hand and create a table to show how the values
of the variables change during program execution. Please use the following
test case: monthly salary = 2000.
Please type and save your answers in Lab01.docx. You may copy the
table from above and just modify it for your program.
PROBLEM 3
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

______________________________________________________________________________________________________________________________________________________________________________________________________________________
CSC121 Lab 01 Page 4
______________________________________________________________________________________________________________________________________________________________________________________________________________________
All jackets in a store are on sale now. They need a program to process
discounts. The user will enter the original price of a jacket and the
discount percentage using a decimal.
For example, only: if the item is 20% off, then the user should
enter 0.20.
The program calculates and displays the following items: price after
discount, sales tax and total amount due. The sales tax rate is 0.07 (7%).
Note: The price after discount is determined by finding the value of the
discount and subtracting that from the original price.
Execute your pseudocode by hand and create a table to show how the values
of the variables change during program execution. Please use the following
test case: original price = 200, discount percentage = 0.20 (i.e. 20%)
Please type and save your answers in Lab01.docx. You may copy the
table from above and just modify it for your program.
PROBLEM 4
A group of high school students are selling pizza and soda during a
basketball game to raise funds for a field trip. Pizza is $3.50 per slice and
soda is $1.25 per cup. Design a program to do the following. Ask the user
to enter the number of cups of soda and the number of slices of pizza
ordered by the customer. The program will calculate and display the total
amount due from the customer.
Execute your pseudocode by hand and create a table to show how the values
of the variables change during program execution. Please use the following
test case: slices of pizza = 4, cups of soda = 2.
Please type and save your answers in Lab01.docx. You may copy the
table from above and just modify it for your program.
Problem 5
A company is sending its employees to receive training on some new
equipment. The training includes two parts: part A and part B. Some
employees will attend part A only, some will attend part B only, while some
will attend both parts. The training provider charges $100 per person for
part A, and $150 per person for part B. They give a 20% discount to people
who attend both parts. (See note above about discounts). Write a program
to calculate how much training fee the company needs to pay in total. The
CSC121 Lab 01 Page 4
______________________________________________________________________________________________________________________________________________________________________________________________________________________
All jackets in a store are on sale now. They need a program to process
discounts. The user will enter the original price of a jacket and the
discount percentage using a decimal.
For example, only: if the item is 20% off, then the user should
enter 0.20.
The program calculates and displays the following items: price after
discount, sales tax and total amount due. The sales tax rate is 0.07 (7%).
Note: The price after discount is determined by finding the value of the
discount and subtracting that from the original price.
Execute your pseudocode by hand and create a table to show how the values
of the variables change during program execution. Please use the following
test case: original price = 200, discount percentage = 0.20 (i.e. 20%)
Please type and save your answers in Lab01.docx. You may copy the
table from above and just modify it for your program.
PROBLEM 4
A group of high school students are selling pizza and soda during a
basketball game to raise funds for a field trip. Pizza is $3.50 per slice and
soda is $1.25 per cup. Design a program to do the following. Ask the user
to enter the number of cups of soda and the number of slices of pizza
ordered by the customer. The program will calculate and display the total
amount due from the customer.
Execute your pseudocode by hand and create a table to show how the values
of the variables change during program execution. Please use the following
test case: slices of pizza = 4, cups of soda = 2.
Please type and save your answers in Lab01.docx. You may copy the
table from above and just modify it for your program.
Problem 5
A company is sending its employees to receive training on some new
equipment. The training includes two parts: part A and part B. Some
employees will attend part A only, some will attend part B only, while some
will attend both parts. The training provider charges $100 per person for
part A, and $150 per person for part B. They give a 20% discount to people
who attend both parts. (See note above about discounts). Write a program
to calculate how much training fee the company needs to pay in total. The
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

______________________________________________________________________________________________________________________________________________________________________________________________________________________
CSC121 Lab 01 Page 5
______________________________________________________________________________________________________________________________________________________________________________________________________________________
program should ask the user to enter the number of people who will only
attend part A, the number of people who will only attend part B, and the
number of people who will attend both parts. It will calculate and display
the total training fee the company needs to pay.
Execute your pseudocode by hand and create a table to show how the values
of the variables change during program execution. Please use the following
test case: number of people who only attend part A = 12, number of people
who only attend part B = 10, number of people who attend both parts = 8.
Please type and save your answers in Lab01.docx. You may copy the
table from above and just modify it for your program.
Grading rubric for Problem 1 - 5
Designing input steps [3 points]
Designing processing steps [7 points]
Designing output steps [3 points]
Showing correct values in variable table [7 points]
CSC121 Lab 01 Page 5
______________________________________________________________________________________________________________________________________________________________________________________________________________________
program should ask the user to enter the number of people who will only
attend part A, the number of people who will only attend part B, and the
number of people who will attend both parts. It will calculate and display
the total training fee the company needs to pay.
Execute your pseudocode by hand and create a table to show how the values
of the variables change during program execution. Please use the following
test case: number of people who only attend part A = 12, number of people
who only attend part B = 10, number of people who attend both parts = 8.
Please type and save your answers in Lab01.docx. You may copy the
table from above and just modify it for your program.
Grading rubric for Problem 1 - 5
Designing input steps [3 points]
Designing processing steps [7 points]
Designing output steps [3 points]
Showing correct values in variable table [7 points]
1 out of 5
Your All-in-One AI-Powered Toolkit for Academic Success.
+13062052269
info@desklib.com
Available 24*7 on WhatsApp / Email
Unlock your academic potential
Copyright © 2020–2025 A2Z Services. All Rights Reserved. Developed and managed by ZUCOL.