Basic Java Chapter 3

  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Basic Java Chapter 3 as PDF for free.

More details

  • Words: 373
  • Pages: 10
Chapter Objectives

Upon completion of this chapter, the student will be able to understand

 Basics of Program Design  Introduction to Program Flowchart  Symbols used in Program Flowchart  Three Program Constructs: Sequence, Selection and Iteration  Use of connector

Introduction to Program Design

There are various program design tools that are used to design a program such as Jackson Structured Program and Psuedocode. In this chapter, we will be looking at another program design tool, which is the Program Flow Chart.

Program Flow Chart is a graphical representation of the program logic in solving a problem. It uses the standard symbols in designing the input, process and output of a program.

Symbols used in Program Flow Chart Symbols

Description Terminal

Input/Outpu

Process

Decision

Connector

Program Flow

Three Program Constructs in Program Flow Chart

All program designs can be constructed using three basic constructs. It is also the concept of structured programming that a program should be developed using the three basic constructs. The three basic constructs in programming are:

sequence selection iteration

When designing the program, we are also able to represent the three basic constructs using the Program Flow Chart.

Sequence In a sequence construct, each instruction is executed in a serial manner, one after another. Start

get num 1

get num 2

answer=num1/num2

display result

stop

Selection The selection construct provides a decision point that allows one of the two characters to be chosen based on some value within a program. Start get num 1 get num 2

num2 = 0?

answer=num1/num2 display result

stop

Display division by 0

Iteration The iteration construct allows a set of instructions to be repeated a number of times based on the condition stated. Start

total = 0

get number

number < 1000

total = total+number

display total

stop

Connector When we have a program where the logic cannot be represented in a flowchart that can fit in one page, we will have to make use of the connector to connect the flowcharts on different pages.

Programming Exercise

Name any 4 symbols used in flowchart.

Use the flowchart to show the three program construct: sequence, selection and iteration.

Connectors are sometimes in drawing a flowchart. Explain when should a connector be used.

Related Documents

Basic Java Chapter 3
June 2020 4
Basic Java Chapter 1
June 2020 2
Basic Java Chapter 2
June 2020 3
Basic Java Chapter 4
June 2020 5
Basic Java
November 2019 17
Basic Java
November 2019 22