You are on page 1of 4

COE0027L

(Computer Programming)

SUMMATIVE

3
USING DIFFERENT FLOW CONTROLS

de Vera, Airell Francis S. Mr. Jonathan Fuller


Date Performed: Oct 10, Date Submitted: Oct 10,
2022 2022
I. OBJECTIVES:

At the end of the experiment, students must be able to:


Cognitive
a) understand the logic of using flow controls.
b) understand how to use flow controls.
c) identify the difference between the different flow controls.
.
Psychomotor:
a) construct a program using flow controls.
b) compile and debug the error of the program

Affective
a) appreciate the concept behind this experiment

II. BACKGROUND INFORMATION

 if-else() performs statements based on two conditions


 switch() performs statements based on multiple conditions
 while() performs statements repeatedly while condition remains true
 do-while() performs statements repeatedly (at least once) while condition remains true
 for() performs statements repeatedly based on a condition

III.EXPERIMENTAL PROCEDURE:

1. Write a program that takes as input a bank account balance and an interest rate and
outputs the value of the account in 10 years. the output should show the value of the
account for three different methods of compounding interest: annually, monthly, and
daily. When compounded annually, the interest is added once per year at the end of the
year. When compounded monthly the interest is added in 12 times per year. When
computed daily, the interest is added 365 times per year. You do not have to worry
about leap years. Assume all years have 365 days. On annual interest, you can assume
that the interest is posted exactly one year from the date of deposit. In other words, you
do not have to worry about interest being posted on a specific day of the year, like
December 31.
Similarly, you can assume monthly interest is posted exactly one month after it in entered.
Since the account earns interest on the interest, the account should have a higher balance
when interest is posted more frequently. Be sure to adjust the interest rate for the time
period of the interest. If the rate is 5%, then when posting monthly interest, you use
(5/12%).When posting daily interest, you use (5/365)%. Do your calculations using a loop
that adds in the interest for each time period. (Do not use some sort of algebraic formula).
Your program should have an outer loop that allows the user to repeat this calculation for a
new balance and interest rate. The calculation is repeated until the user indicates that
she/he wants to end the program.

IV. QUESTION AND ANSWER:

1. What is the significance of using control structures?


Form the fundamental building elements of computational decision-making processes.

2. For you, which is preferably the most convenient control structure to be used in
comparisons, IF-ELSE or SWITCH?
Usually, a switch statement is more effective than a series of nested ifs. Readability and
the expression that the statement is testing should be taken into consideration when
deciding whether to employ if-then-else statements or a switch statement.

3. Do SWITCH and IF-ELSE have differences?


The switch case statement is used to make a decision between several alternatives, while
the if-else statement is used to make a decision between two options.

4. Which is the easiest way in looping? Explain.


The simplest way to conceive of the loop is that it leaps back up to the beginning when it
hits the brace at the end, where it checks the condition once again and determines
whether to repeat the block again or stop and continue on to the statement after the block.

V. ASSESSMENT

Department Computer Science Department


Subject Code COE0027L
Description Computer Programming
Term/Academic Year 1 / 2020-2021

Topic Control Flow Statements


Lab Summative 3
No.
Lab Summative Using Different Flow
Controls
CLO 2

Note: The following rubrics/metrics will be used to grade students’ output in the Lab
Summative 3.

Criteria Score
Program execution (20)
Correct output (20)
Design of output (10)
Design of logic (20)
Standards (20)
Delivery (10)
TOTAL

You might also like