Presentation is loading. Please wait.

Presentation is loading. Please wait.

Jaeki Song ISQS6337 Lecture 01 Introduction. Jaeki Song ISQS6337 Instructor Name: Jaeki Song Office: BA 712 Office Hours Tuesday & Thursday 2:00-3:20.

Similar presentations


Presentation on theme: "Jaeki Song ISQS6337 Lecture 01 Introduction. Jaeki Song ISQS6337 Instructor Name: Jaeki Song Office: BA 712 Office Hours Tuesday & Thursday 2:00-3:20."— Presentation transcript:

1 Jaeki Song ISQS6337 Lecture 01 Introduction

2 Jaeki Song ISQS6337 Instructor Name: Jaeki Song Office: BA 712 Office Hours Tuesday & Thursday 2:00-3:20 PM or by appointment Office Phone: (806) 742-8036 E-mail: jsong@ba.ttu.edujsong@ba.ttu.edu Website: http://jsong.ba.ttu.edu

3 Jaeki Song ISQS6337 Course Materials Required Textbook Deitel and Deitel, Java How to Program, 4 th Edition, Prentice Hall

4 Jaeki Song ISQS6337 Course Objectives Objectives –Introduce OOP using JAVA –Understand JAVA programming –Understand the issues related to web- programming using JAVA –Emphasize critical thinking about new developments

5 Jaeki Song ISQS6337 Grading First Exam: 20% Second Exam: 20% Third Exam: 30% Assignments: 30%

6 Jaeki Song ISQS6337 Course Structure Fundamentals of programming Object-oriented programming Graphics programming Developing comprehensive programming

7 Jaeki Song ISQS6337 Objectives B asics of Programming Language W hat is Java? I ntroduction to Java Applications

8 Jaeki Song ISQS6337 Programming A computer program is a set of instructions that you write to tell a computer what to do A high-level programming language allows you to use a vocabulary of reasonable terms –Each high-level language has its own syntax or rules of the language –Programmers use a computer program called compiler to translate their high-level language statements into machine code –In addition, the logic behind any program involves executing the various statements and procedures in the correct order to produce the desired results

9 Jaeki Song ISQS6337 Approaches Procedural programming –Defines the variable memory locations, and then calls or invokes a series of procedures to input, manipulate, and output –A single procedural programming often contains hundreds of variables and thousands of procedures calls Object-oriented programming –An extension of procedural programming –Thinking in an object-oriented manner involves envisioning program components

10 Jaeki Song ISQS6337 Algorithmic Thinking Correct –Using logical constructs and valid data in an organized way The steps will be carried out correctly The program will make suitable response Efficient –The program’s ability to deliver a results in a time short enough to be useful and in a space small enough An algorithm can be defined in various ways. Common ways include the use of pseudocode, flowchart, and storyboard

11 Jaeki Song ISQS6337 Pseudocode uses English-like phrases to describe the instructions –List the actions using keywords –Depicts logical grouping or structures using indentation MAIN MODULE: Call Initialization Call Process Call Output END PROCESS MODULE: Do While not End of File Read a record Call Calculate Call Accumulate Print Detail Line End Do RETURN CALCULATE MODULE: If Hours > 40 then Call overtime Else Call Regular time End If RETURN

12 Jaeki Song ISQS6337 Flow Chart Process Symbol Represent process I/O Symbol Makes data available for processing (input) or Displaying (output) of process information Decision symbol Represents a decision that determines which Of number of alternative paths is to be followed Connector symbol Represents any entry form, or exit to, another part of the flow chart Terminal symbol Represents the beginning, the end, or a point of Interruption or delay in a program

13 Jaeki Song ISQS6337 Storyboard Interest Calculator Principal: Interest Rate: Months: Amount Paid: Calculate Clear principalField amtlField clearButton monthslField calButton monthsLabel intLabel principalLabel intField amtLabel

14 Jaeki Song ISQS6337 Fundamentals of Programming Data Declaration and Assignment Relational Operators Programming Style and Documentation

15 Jaeki Song ISQS6337 Data Categorize data as variable or constant Constant –Data cannot be changed Variable –Data might be changed –Variable are named memory locations that your program can use to store values –Java provides eight primitive types of data Boolean, byte, char, short, long, int, float, double

16 Jaeki Song ISQS6337 The Int Data Type Type Minimum Value Maximum Value Size in Bytesbyte - 128 127 1short - 32,768 32,767 2Int - 2,147,483,648 2,147,483,647 4long - 9,223,372,036,854,775,808 9,223,372,036,854,775,807 8

17 Jaeki Song ISQS6337 Declaration and Assignment Variable declaration –To use a variable, you declare it by telling the compiler the name of the variable as well as what type of data it represents datatype variableName e.g. int x; //Declare x to be an integer variable After a variable is declared, you can assign a value to it by using an assignment statement variable = expression; e.g. x = 1; //Assing 1 to variable x x = y + 1 ; //assign the addition of y and 1 to x –You can declare variable and initialize it in one step int x; x = 1 int x = 1;

18 Jaeki Song ISQS6337 Arithmetic Statements Operator Description Example+ addition 45+2, the result is 47- subtraction 45-2, the result is 43* multiplication 45*2, the result is 90/ addition 45/2, the result is 22 (not 22.5)% modulus (remainder) 45%2, the result is 1

19 Jaeki Song ISQS6337 The boolean Data Type Boolean logic is based on true-false comparisons Boolean variable –A variable that holds a Boolean value (true or false) Operator Name Example !Not && andtrue && true  true | |orfalse | | false  false

20 Jaeki Song ISQS6337 Floating-point Data Types Type Minimum Value Maximum Value Size in BytesFloat - 3.4 * 10 38 3.4 * 10 38 4double - 1.7 * 10 308 1.7 * 10308 8

21 Jaeki Song ISQS6337 Relational Operators Relational operator Operator Name Example Answer < less than 1 < 2 true <= less than or equal to 1 <=2 true > greater than 1 > 2 false >= greater than or equal to 1 >= 2 false = = equal to 1 = = 2 false != not equal to 1 != 2 true

22 Jaeki Song ISQS6337 Constant A constant represents permanent data that never changes final datatype CONSTANTNAME = VALUE; In java, the world final means that the constant cannot be changed. e.g. final double PI = 3.14159;

23 Jaeki Song ISQS6337 Programming Style and Documentation Appropriate Comments –Every program has the following block comment appear at the top of the source code file: /*Programmer: Jaeki Song Course:ISQS 6337 File Name:Assign1XXXX.java Description:A brief description of the program */

24 Jaeki Song ISQS6337 Naming conventions –Make sure the meanings of the descriptive means you choose are straightforward –Names are case-sensitive For variables and methods –Use lowercase –If the name consists of several words, concatenate them into one, making the first word lowercase and capitalizing the first letter of each subsequent word e.g: calculateSalary For class names –Capitalize the first letter of each word e.g; ComputeSalary For constants –All letters are capitalized e.g.: MAX_VALUE = 10 Programming Style and Documentation

25 Jaeki Song ISQS6337 Programming Style and Documentation Proper indentation and spacing –Clear and easy to read e.g.: public class Test { public static void main(String args[]) { System.out.println(“Example”); }

26 Jaeki Song ISQS6337 Programming Errors Syntax error –Result from errors in cod construction E.g.: mistyping, omitting some necessary punctuation, using an opening brace without a corresponding closing brace Logical error –Occur when a program does not perform the way it was intended to Run-time error –Cause a program to terminate abnormally E.g. –Input error: the user enters an unexpected input value that the program cannot handle –Division by zero

27 Jaeki Song ISQS6337 Formatting Output Escape characters CodeConceptResult \t Horizontal tab Moves insertion point eight spaces to the right \b Backspace Moves insertion point one space to the left \n New line Moves insertion point down one line and to the left margin \r Carriage return Moves insertion point to the left margin \” Double quote Used to print a double quote character


Download ppt "Jaeki Song ISQS6337 Lecture 01 Introduction. Jaeki Song ISQS6337 Instructor Name: Jaeki Song Office: BA 712 Office Hours Tuesday & Thursday 2:00-3:20."

Similar presentations


Ads by Google