Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Purposes: Learn JAVA 1.What is programming languages 2.How to solve problems by computers 1.a CS major student, get a degree in BS 2.a programmer  system.

Similar presentations


Presentation on theme: "1 Purposes: Learn JAVA 1.What is programming languages 2.How to solve problems by computers 1.a CS major student, get a degree in BS 2.a programmer  system."— Presentation transcript:

1 1 Purposes: Learn JAVA 1.What is programming languages 2.How to solve problems by computers 1.a CS major student, get a degree in BS 2.a programmer  system manager  project leader 3.a computer scientist is worthwhile and doable. Being

2 2 HardwareSoftware Theory 1800 AD  Architecture 1945 AD  What is Computer Science? Languages 1960 AD 

3 3 Alan Turing (1912-1954) – The Enigma The man who invented the computer Image from http://ei.cs.vt.edu/~history/Turing.htmlhttp://ei.cs.vt.edu/~history/Turing.html Turing Machines Turing Award: the Nobel Prize in CS

4 4 Said: “Turing Machines are human that compute.” “ In logic nothing is accidental ” Ludwig Wittgenstein (1889-1951) Image from http://www.ags.uci.edu/~bcarver/wgallery.htmlhttp://www.ags.uci.edu/~bcarver/wgallery.html

5 5 Hardware Input deviceOutput device Central Processor Unit: Internal Storage Control Unit + Arithmetic-Logic Unit (ALU)

6 6 Software 0 1 1 0 0 0 0 1 1 1 0 0 2 4 =16

7 7 A bit logical, Adder (half adder) 1 +)1 1 0 1 0 1 0 1 1 0 0 0 A B c S ABcS 0000 0101 1001 1110 A B S c Adder ABAB

8 8 Full Adder CiCi A +)B CoCo S CiCi ABCoCo S 00000 00101 01001 01110 10001 10110 11010 11111 A B S Co Full Adder Ci

9 9 4 bits Adder Full Adder Full Adder Full Adder Full Adder A B0 110 1 010 1011 0 010 01 0 0 1011 +)0010 1101 100

10 10 Logical Gates for an Adder (half adder) A +)B c S ABcS 0000 0101 1001 1110 AND OR AND NOT B A S c 1 1 0 1 1 1 1 1 1 1 1 0 0 Half-Adder

11 11 Software: 1.Operation systems 2.Applications XP, Unix, VAX Words Excel E.I. Hello Java Hello.java javac Hello.class (class loader) Eclipse, NetBean IDE, SunSun

12 12 IDE ( Integrated Development Environment ) 1.A customized plain text editor 2.Compiler 3.Loader 4.Debugging tool Java 2 Software Development Kit (J2SDK) Eclipse 1.notepad 2.javac hello.java 3.java hello 4.......

13 13 Solving a problems by computers. 1+2+3+4+..............+98+99+100 = ? 0 + 1 = sum1; sum1+2=sum2 sum2+3=sum3 sum3+4=sum4 sum4+5=sum5 sum5+6=sum6............. sum99+100 = sum100 0+1=1 1+2=3 3+3=6 6+4=10 10+5=15 15+6=21............... 4950+100=5050

14 14 Solving a problems by computers. 0 + 1 = sum1 sum1+2=sum2 sum2+3=sum3 sum3+4=sum4 sum4+5=sum5 sum5+6=sum6............. sum99+100 = sum100 sum = 0 sum = sum+1 sum = sum+2 sum = sum+3 sum = sum +4 sum = sum +5............. sum = sum+100 computer can do the same thing again and again fast

15 15 Algorithm: a procedure of calculating (manipulate) data 1+2+3+4+.............. +98+99+100 = ? sum = 0 sum = sum+1 sum = sum+2 sum = sum+3 sum = sum +4 sum = sum +5...... sum = sum+100 sum = 0; i = 1; while (i <= 100) do the following { sum = sum + i; i = i+1; } sum is the answer;

16 16 Graph Reachability G: (V,E) V: the set of vertices E: the set of edges 1 5 4 6 3 2 7 V = {1,2,3,4,5,6,7} E = {(1,2), (1,3), (1,4) (3,6),(5,6), (5,7)} Is there a path from 1 to 6 in G? Is there a path from 1 to 7 in G?

17 17 Algorithm for Graph Reachability: Input G: (V,E), a,b; let S = {a}; mark a; while (s  {}) do the following select one element from S; let it be x; remove x from S; let N = { y : (x,y) in E }; if b in N, say “yes” and stop; mark every b in X; set S = S union N; say “no”; Is there a path from a to b in G? Java C++ C Fortran Fortran90 Lisp Ada COBOL BASIC Pascal Polog

18 18 Pr8oblems  Solutions cycle Problems System analyst, Project leader Algorithms Senior Programmers Programs in C++ (or any high level Programming Language) compiler Assembly Assembler Machine code linker Results Customers Programmers Syntax Semantics 95% (human) IDE 5% (computers)

19 19 Procedure vs Object To write a program is: To find a way to manipulate data -- We design procedures Procedure-Oriented Programming Statements + functions  programs To find data to manipulate – We choose data (object) Object-Oriented Programming Classes + Objects  programs (interfaces, methods, attributes…)

20 20 Classes: A class is a concept of something Vehicle 4 wheels, seat, engine, windows…… Truck ………… Sedan ………… SUV …………

21 21 Method & Attribute class: Method &Attribute Method: behaviors (operation, functionalities) Field (attribute): the properties the class

22 22 Objects Vehicle SUV Honda Pilot 011-JAV instantiation Class Object

23 23 A Java Program: // Fig. 2.1: Welcome1.java // Text-printing program. public class Welcome1 { // main method begins execution of Java application public static void main( String args[] ) { System.out.println( "Welcome to Java Programming!" ); } // end method main } // end class Welcome1 /********************************************************* *(C) Copyright 1992-2003 by Deitel & Associates, Inc. and * * Prentice Hall. All Rights Reserved. * **********************************************************/


Download ppt "1 Purposes: Learn JAVA 1.What is programming languages 2.How to solve problems by computers 1.a CS major student, get a degree in BS 2.a programmer  system."

Similar presentations


Ads by Google