Designing control statements
Flow control can be somewhat confusing at first. It can be difficult for inexperienced programmers to visualize the flow of a program. This is where flowcharting can help new programmers visualize the flow of the program. Flowcharting may appear to be a pointless design technique. However, it can greatly help alleviate confusion and make the flow of the code more understandable where multiple flow paths exist. To better under this concept, let’s design and implement a simple bank account overdraft program.
Overdraft program
Most bank accounts will throw some type of warning message when a user withdraws too much money from their bank account. In real-world practice, a lot goes into the software that governs bank accounts; nonetheless, a simple IF
statement can easily simulate the same behavior. The first phase in implementing this program is designing the flow of the program.
Program design
For this program, we can use a design like the...