Lesson 2: Program design process & Intro to code

Slides:



Advertisements
Similar presentations
Java Planning our Programs Flowcharts Arithmetic Operators.
Advertisements

Introduction to working with Loops  2000 Prentice Hall, Inc. All rights reserved. Modified for use with this course. Introduction to Computers and Programming.
Introduction to Computers and Programming Lecture 4: Mathematical Operators New York University.
Mathematical Operators  2000 Prentice Hall, Inc. All rights reserved. Modified for use with this course. Introduction to Computers and Programming in.
1 The First Step Learning objectives write Java programs that display text on the screen. distinguish between the eight built-in scalar types of Java;
Introduction to Programming David Goldschmidt, Ph.D. Computer Science The College of Saint Rose Java Fundamentals (Variables, Arithmetic, etc.)
9/6: Variable Types, Arithmetic Operators, Comparison Operators Addition.java in depth Variable types & data types Input from user: how to get it Arithmetic.
1 Variables. 2 Receipt example What's bad about the following code? public class Receipt { public static void main(String[] args) { // Calculate total.
Programming with Visual C++: Concepts and Projects Chapter 2B: Reading, Processing and Displaying Data (Tutorial)
Mathematical Calculations in Java Mrs. G. Chapman.
Copyright 2008 by Pearson Education 1 Building Java Programs Chapter 2 Lecture 2-1: Expressions and Variables reading:
1/28: Inputs, Variable Types, etc. Addition.java in depth Variable types & data types Input from user: how to get it Arithmetic operators.
Mathematical Calculations in Java Mrs. C. Furman.
Introduction to Computing Concepts Note Set 15. JOptionPane.showMessageDialog Message Dialog Allows you to give a brief message to the user Can be used.
Copyright 2010 by Pearson Education 1 Building Java Programs Chapter 2 Lecture 2-1: Expressions and Variables reading:
Arithmetic Expressions Addition (+) Subtraction (-) Multiplication (*) Division (/) –Integer –Real Number Mod Operator (%) Same as regular Depends on the.
1 Class Chapter Objectives Use a while loop to repeat a series of statements Get data from user through an input dialog box Add error checking.
Introduction to Computers and Programming Lecture 7:
CompSci 230 S Programming Techniques
Lecture 2 D&D Chapter 2 & Intro to Eclipse IDE Date.
Chapter 2 Basic Computation
Expressions.
Lecture 4: Expressions and Variables
PowerPoint Presentation Authors of Exposure Java
Building Java Programs
2.5 Another Java Application: Adding Integers
Primitive Data, Variables, Loops (Maybe)
Variables, Expressions, and IO
Introduction to C++ October 2, 2017.
Arithmetic Operators Topics Arithmetic Operators Operator Precedence
SELECTION STATEMENTS (1)
Operators and Expressions
OPERATORS (1) CSC 111.
Building Java Programs Chapter 2
Arithmetic Operators Topics Arithmetic Operators Operator Precedence
Introduction to C++ Programming
Advanced Programming Lecture 02: Introduction to C# Apps
Chapter 2 - Introduction to Java Applications
Building Java Programs
Escape sequences: Practice using the escape sequences on the code below to see what happens. Try this next code to help you understand the last two sequences.
Building Java Programs
MSIS 655 Advanced Business Applications Programming
Addition & Subtraction
Data Types, Concatenation, PEMDAS, Shortcuts, and Comments
Variables & Data Types Java.
Building Java Programs Chapter 2
Building Java Programs
Building Java Programs
Algorithms computer as the tool process – algorithm
Chapter 2: Java Fundamentals
Building Java Programs
Chapter 2 Programming Basics.
Building Java Programs
Building Java Programs
Building Java Programs
Introduction to C Programming
Building Java Programs
Lecture 4: Expressions and Variables
Building Java Programs
Building Java Programs
Building Java Programs
Building Java Programs
Building Java Programs Chapter 2
Building Java Programs
Unit 1: Intro Lesson 4: Output.
Building Java Programs
Building Java Programs
Building Java Programs
COMPUTING.
Python Creating a calculator.
Presentation transcript:

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

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)

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

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;

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 (“ “);

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) } }

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