Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lesson 2: Program design process & Intro to code

Similar presentations


Presentation on theme: "Lesson 2: Program design process & Intro to code"— Presentation transcript:

1 Lesson 2: Program design process & Intro to code
Unit 1: Introduction Lesson 2: Program design process & Intro to code

2 Program Design Process
Define – Purpose, Input, Processes, Output (remember: P.I.P.O) Visualize – What does the Input area look like? What does the Output Area look like? Algorithm – Organize when input is received, when data is stored, when operations are performed when output is displayed etc. Pre-Debug – Look for logical/organization errors in your algorithm Program – Write the code based on your algorithm and syntax Debug – Fix all syntactical errors & Logic/Mathematic errors Accuracy check – Did your program give the result you wanted? If not, check your algorithm (repeat the last two steps until the program works properly)

3 Program “Skeleton” public class ProgramName { public static void main (String[] args) { //Variable Declarations //Input Statements //Processing/Logic Statements //Output Statements } }

4 Declaring a Variable Non Initialized Variable
VariableType VariableName ; int myVariable; Initialized Variable VariableType VariableName = InitialValue; int myVariable = 10; Final (Immutable Variable) final VariableType VARIABLENAME; final int MYVARIABLE = 10;

5 Output Any data displayed to the user is considered output
Output will generally take two forms Editable/Non-Editable Non-Editable – System.out.print (“ “); System.out.println (“ “); JOptionPane.showMessageDialog (“ “); Editable - JOptionPane.showInputDialog (“ “);

6 Simple Program public class SomeMath { public static void main (String [] args) { //Variable Declarations float numOne = 10; float numTwo = 5; float answer; //Arithmetic answer = numOne + numTwo; //Output System.out.println(“10 plus 5 is ” + answer) } }

7 Common Operators (Reference)
Relational Arithmetic Assignment < Less Than + Addition = <= Less Than or Equal to - Subtraction += Add to Existing Value > Greater Than * Multiplication -= Subtract from Existing Value >= Greater Than or Equal to / Division *= Multiply by Existing Value == Equal to % Modulus (Remainder) Divide by Existing Value != Not Equal to %= Add Remainder to Existing Value First bullet point here Second bullet point here Third bullet point here


Download ppt "Lesson 2: Program design process & Intro to code"

Similar presentations


Ads by Google