CS 1101 Programming Assignment Unit 4
CS 1101 Programming Assignment Unit 4
To apply incremental development to the task given by the manager, I could do the following
steps:
Initial Setup:
First, defining the basic structure of the function hypotenuse which will take two parameters
Introducing the calculation of the squares of the two legs within the function.
Implementing the final computation of the hypotenuse using the Pythagorean theorem.
At this stage, the function should correctly compute the hypotenuse based on the inputs.
Each test checks the function with triangle sides where the hypotenuse is known, verifying if the
By following these steps, I can methodically develop the function, ensure each component works
as intended before adding more complexity, and effectively minimize potential errors at each
development stage. This process aids in both developing a robust function and in understanding
function using incremental development, a method emphasized in this week's reading. This
approach involves building the function in, manageable steps, ensuring each part works correctly
I started by outlining what my function should do—calculate the Body Mass Index (BMI) based
on height and weight inputs. The simplest version of the function just received the inputs and
Output:
2. Incremental Development:
Next, I incorporated the BMI calculation formula into the function. I tested it with known values
Output:
3. Enhancing Functionality:
Then, I added functionality to interpret the BMI result according to medical standards (CDC,
n.d.).
Output:
4. Refinement and Documentation:
Finally, I added comments to the code to explain each section and ensure it’s understandable to
others. This helps in maintaining the code and is good practice for professional development.
Using incremental development for the creation of the BMI function allowed for meticulous
validation of each segment of the code. This approach minimized the potential for errors and
simplified debugging, as each part was confirmed to operate correctly before additional
initial input validation to complex logical assessments—helped ensure the function's reliability
and maintainability. The clear documentation accompanying each step further enhanced the
https://www.cdc.gov/healthyweight/assessing/index.html#:~:text=If%20your%20BMI%20is
%20less,falls%20within%20the%20obese%20range
Downey, A. (2015). Think Python: How to think like a computer scientist. Needham,