Lab 2: Flowcharts, Programming, and Tracing | CMSC 105 Elementary Programming - Fall 2024

Lab 2: Flowcharts, Programming, and Tracing

Points Possible: 100

Due: Thursday, September 12th

In this lab, we will practice the concepts learned in week two. We will use flowcharts, tracing, and Python programming to solve the problems.

Submission:

  1. Please submit flowcharts for each program design.
  2. Submit a Python file for each of the four programs.
  3. Submit tracing tables of each program (similar to how we practiced in class).

Program 1: Compute the volume of a cylinder

Draw a flowchart of the program design take a picture and save it as flow1.png and attach it to the Blackboard lab assignment.

Write a program that reads in the $radius$ and $length$ of a cylinder and computes the $area$ and $volume$ using the following formulas:

\[area = radius * radius * \pi\] \[volume = area * length\]

Please print the $area$ and $volume$ values.

Save the program is cylinder.py and attach it to the Blackboard lab assignment.

Complete a tracing table of the program above and take a picture and save it as trace1.png and attach it to the Blackboard lab assignment.

Program 2: Miles to kilometers

Draw a flowchart of the program design take a picture and save it as flow2.png and attach it to the Blackboard lab assignment.

Write a program that takes an input value in miles and converts and displays an equivalent value in kilometers (note that 1 mile is 1.609 kilometers).

Save the program is m2k.py and attach it to the Blackboard lab assignment.

Complete a tracing table of the program above and take a picture and save it as trace2.png and attach it to the Blackboard lab assignment.

Program 3: Financial application: calculate interest

Draw a flowchart of the program design take a picture and save it as flow3.png and attach it to the Blackboard lab assignment.

If you know the $balance$ and the annual percentage interest rate, you can compute the $interest$ on the next monthly payment using the following formula:

\[interest = balance * (AnnualInterestRate / 1200)\]

Write a program that reads the $balance$ and the annual percentage interest rate and displays the $interest$ for the next month.

Save the program is finance.py and attach it to the Blackboard lab assignment.

Complete a tracing table of the program above and take a picture and save it as trace3.png and attach it to the Blackboard lab assignment.

Program 4: Physics - find runway length

Draw a flowchart of the program design take a picture and save it as flow4.png and attach it to the Blackboard lab assignment.

Given an airplane’s acceleration $a$ and takeoff speed $v$, you can compute the minimum runway $length$ needed for an airplane to takeoff using the following formula:

\[length = v^2 / 2a\]

Write a program that prompts the user to enter velocity $v$ and acceleration $a$ and displays the minimum runway $length$.

Save the program is physics.py and attach it to the Blackboard lab assignment.

Complete a tracing table of the program above and take a picture and save it as trace4.png and attach it to the Blackboard lab assignment.

Grading Rubric for each of the programs:

Grading Points Possible
Appropriate header and comments 5
Input 2
Flowchart 3
Computation 5
Print output 5
Tracing 5

TOTAL 25 points for each program