Java Flowchart Study Kit
Introduction

Programming flowcharts, for Java

A flowchart is a picture of your program's logic. Learn the symbols, see how each flowchart turns into Java code, then check yourself with short quizzes.

What is a flowchart?

A flowchart is a diagram that shows the step-by-step solution to a problem (an algorithm). Each kind of step has its own symbol, and arrows (flow lines) show the order the steps run in.

Programmers draw flowcharts before writing code to:

  • Plan the logic without worrying about Java syntax yet.
  • Find mistakes early, like a loop that never ends or a missing case.
  • Explain the program to someone else (your professor, your groupmates).

Once the flowchart is correct, turning it into Java is mostly translation: each symbol becomes one or more Java statements.

The 5 symbols you'll use most

Terminal
Start / End
Input / Output
Scanner, System.out.println
Process
Assignments and calculations
Decision
if, while, loop conditions
Flow line
Order of execution

One problem, three ways

Here's the same problem written as an algorithm, a flowchart, and Java code. Problem: compute the area of a rectangle.

1. Algorithm (pseudocode)

  1. Start
  2. Input length and width
  3. area = length × width
  4. Output area
  5. End
Start Input length, width area = length * width Output area End
2. Flowchart

3. Java

// Start
Scanner sc = new Scanner(System.in);
// Input
double length = sc.nextDouble();
double width  = sc.nextDouble();
// Process
double area = length * width;
// Output
System.out.println(area);
// End

The three control structures

Every program, no matter how big, is built from only three patterns. Learn to recognize them in a flowchart and you can read (and draw) almost anything on the quiz.

Rules for a good flowchart

  • Exactly one Start and at least one End terminal.
  • Flow goes top to bottom, left to right. Arrows show any other direction.
  • Every decision has two exits, labeled True/False (or Yes/No).
  • Keep the text inside each symbol short: one action per symbol.
  • Every path must eventually reach End. If one can't, you have an infinite loop.
  • Flow lines should not cross. Use a connector (small circle) if they would.

How to study for tomorrow

  1. Read the Lessons (about 20 minutes). Use the step-through tracer on the while loop.
  2. Take each quiz. They're 10 questions each and the order is shuffled every time, so retake them until you score 9/10 or better.
  3. Download the cheat sheet for a last look before the quiz, and try the practice worksheet with a classmate.

Heads up: This kit uses the common ANSI/ISO flowchart symbols. If your professor draws something differently (for example a hexagon for for loop setup), follow your professor's notation on the quiz.