Algorithms and Methods
Learning Objectives
In addition to all previous competencies, upon completion of this unit, you should be able to:
- Understand general problem-solving strategies
- Identify Nouns and Verbs
- Create Defining Diagrams
- Create Solution Algorithms
- Create a Test Plan
- Write Java code based on a Solution Algorithm
- Understand the purpose of Methods
- Understand how to create and call Void Methods
- Understand how to create and call Methods that Return a Value
Learning Activities
In this unit, you will learn how to break a problem down, design the solution algorithm, and then turn the algorithm into runnable code. This unit will help you to think through your intended solution before you start to write Java code. You will also explore methods to learn how and why we use. You will learn the differences and similarities between void methods and methods that return a value. You will learn to create and call methods.
Each link below takes you to a specific chapter within this unit. Please take the time to review all the chapters and when available, complete the interactive activities.
"Have patience. All things are difficult before they become easy." -Saadi
- 5-Step Solution Algorithm
- Pseudocode
- Defining the Problem
- Inputs, Processes, and Outputs
- Identify the Nouns (Step 1)
- Identify the Verbs (Step 1 continued)
- Creating a Defining Diagram a.k.a. IPO Chart (Step 2)
- Developing a Solution Algorithm (Step 3)
- The Constructor
- The Method
- The Method Body - Processes
- Writing a Test Plan (Step 4)
- Translating the Solution Algorithm to Java Code (Step 5)
- What You Learned
- Methods Overview
- What are Methods?
- (Re)usability
- Method Signatures (a.k.a Headers or Definitions)
- Method main()
- Void Methods
- Methods that Return a Value
- Constructor
- Access Modifiers
- One Primary Task
- Calling a Method
- Arguments and Parameters
- Order Matters!
- Additional Resources
- What You Learned
- Void Methods
- Methods in your Projects
- Naming Methods
- (Re)using Methods
- Who is in Charge?
- Signature for a
voidMethod - One Primary Task
- Test Your Knowledge - Interactive Activity
- Calling Methods
- Think Logically
- Additional Resources
- Detailed Example (downloadable code)
- Methods that Return a Value
- Return Types
- Naming Methods
- (Re)using Methods that Return a Value
- Who is in Charge?
- Signature for a Method that Returns a Value
- One Primary Task
- Calling Methods
- Think Logically
- Choosing between
voidMethods and Methods that Return a Value