Slide 2 - COP3502 Programming Fundamentals for CIS Majors 1...

Info iconThis preview shows pages 1–21. Sign up to view the full content.

View Full Document Right Arrow Icon
COP3502 Programming Fundamentals for CIS Majors 1 Instructor: Parisa Rashidi
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Two other TA -Hengxing Tan, [email protected] , E402, Monday, 1:00 pm – 3:00 pm -Haitham Gabr, [email protected] , E309, Thursday, 10:00 am – 12:00 pm PA 1 extended to Monday Jan 23 No need to turn in actual program for HW SAKAI Objectives
Background image of page 2
OOP class definition packages GUI Dialog Last Class
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Program design Java primitive data types Java operators Input from the console & GUI Programming style, and naming conventions Objectives
Background image of page 4
Algorithm Design
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Suppose we want to write a simple program for computing the area of a circle. Where do we start? Algorithms
Background image of page 6
Writing a program is 1. Designing algorithms 2. Translating algorithms into code Algorithms can be in Natural language Pseudo-code Natural language mixed with programming code Algorithms
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
1. Read in the radius 2. Compute the area using the following formula 3. Display the area Algorithms Area = radius × radius × °
Background image of page 8
Every Java program begins with a class Algorithms to Code public class ComputeArea { }
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Every Java program should have a main method Algorithms to Code public class ComputeArea { public static void main(String[] args) { } }
Background image of page 10
Identify steps Algorithms to Code public class ComputeArea { public static void main(String[] args) { //step 1: read in radius //step 2: compute area //step 3: Display the area } }
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Identify variables Algorithms to Code public class ComputeArea { public static void main(String[] args) { double radius; double area; //step 1: read in radius //step 2: compute area //step 3: Display the area } }
Background image of page 12
Fill in the steps Algorithms to Code public class ComputeArea { public static void main(String[] args) { double radius; double area; //step 1: read in radius radius = 20; //step 2: compute area //step 3: Display the area } }
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Fill in the steps Algorithms to Code public class ComputeArea { public static void main(String[] args) { double radius; double area; //step 1: read in radius radius = 20; //step 2: compute area area = radius * radius * 3.14; //step 3: Display the area } }
Background image of page 14
Fill in the steps Algorithms to Code public class ComputeArea { public static void main(String[] args) { double radius; double area; //step 1: read in radius radius = 20; //step 2: compute area area = radius * radius * 3.14; //step 3: Display the area System.out.println(“area is: ” + area); } }
Background image of page 15

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Variables
Background image of page 16
A variable stores a piece of data int x =10; Identifier Name of your variable 1. letters, digits, underscores (_) , dollar signs ($) 2. Cannot start with a digit 3. Cannot be a reserved word E.g. cannot be: class Variable X 23 Variable Identifier Literal
Background image of page 17

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon