Part of Course: Introduction to Computer Programming Model
Unit Overview / Details
This unit introduces the students to programming concepts invovled with decision making and iteration using if statement, logical operators, c onditional operators, compound relational tests, nested if statements, the multipathway switch structure, loops, nested loops, and recursion.
- Class Time
- 3 Class Periods
Content / Concepts
Students will have mastered the material in this unit when they can:
- List and describe the three major elements of logical structure found in algorithms
- List several criteria that should be met by each linear sequence in an algorithm
- Describe the difference between binary bypass and binary choice branching routines
- Describe the difference between a pretest loop and a posttest loop
- List and describe the four major parts of a count-controlled loop
- List and describe the size logical comparison operations used in computer programming
- List and describe the three major operations in Boolean logic
- Create methods in Alice that implement each of the following:
- a binary bypass
- a binary choice
- a count-controlled loop
- a sentinel loop that is not count-controlled
- Create a compound Boolean expression in an Alice looping or branching instruction
Lessons in this Unit
This lesson introduces students to java programming concepts of decision making. They will learn programming constructs like if statements, if else statements, compound relational tests, nested if statements. They will also use the multipath switch structure.
Let us understand the following:
1). that codes will execute sequentially by default.
2). More complex codes will require conditional execution. This involves the execution of a statement or a block of code based on a condition being met. If statements, if else statements, nested if else statements, switch structure.
3). Some codes may need repetitive execution. This is reserved for the next lesson where we will take a deeper look at loops in java and how the same block of code can be repeated a given number of times. Examples of iteration include for loops, while loops, for … while loops.
4). Transfer is generally regarded as poor programming style, but it refers to where the point of execution jumps to another point in the program. This creates difficulty and discontinuity in the logic of the program making it hard to understand. break, continue, and return.
- Class time
- 1 Class Period
This lesson introduces the students to a practical understanding of logical strutures in java programming. They will be able to develop the truth tables for the AND, OR, and NOT logical operators. The will learn the use of logical operators in building compund statements for use in a control flow of statement execution.
This lesson introduces students to the different types of repetition structures: the for loop, the while loop, and the do while loop. The lesson will also describe example of where of they apply including the concept of counting.
This lesson will introduce the algorithmic process known as recursion. This process involves a method that calls itself. Recursive algorithms are common in computer science and in our everyday lives. Recursion presents another simpler way to approach some of the iterative processes handled earlier in the loop construct.
- 1 Class Period