CPE 150L Laboratory 3: Control Structures I: 1 Objectives
CPE 150L Laboratory 3: Control Structures I: 1 Objectives
CPE 150L Laboratory 3: Control Structures I: 1 Objectives
1 Objectives
• To understand basic problem-solving techinques.
• To be able to develop algorithms through the process of top-down stepwise refinment.
• To be able to use the if and if/else structures to choose among alternative actions.
• To be able use the increment, decrement, assignment and logical operators.
where weight is measured in pounds and height is measured in inches. The program should display a message indicating whether
the person has optimal weight, is underweight, or is overweight. A sedentary person’ s weight is considered to be optimal if his
or her BMI is between 18.5 and 25. If the BMI is less than 18.5, the person is considered to be underweight. If the BMI value is
greater than 25, the person is considered to be overweight.
[Optional : Input Validation] Display an error message if the user enters a number outside the range of 1 through 4 when selecting
an item from the menu. Do not accept negative values for the circle’s radius, the rectangle’s length or width, or the triangle’s base
or height.
1
4 Lab Exercise 3 - Stepwise Function
Write a program that calculates and prints the value of a stepwise function f(t) based on the intervals given in the figure bellow.
The program shoul ask for the t vallue.