Title: Programming Languages
1Programming Languages
?.????????? ?????????????????????????? ?????
3503500 ??? 715E-mail pattamaporn.p_at_bu.ac.thHom
epage http//tulip.bu.ac.th/pattamaporn.p/
2What is a Computer Program?
- ?????????????????? (Instructions-codes)
???????????????????? CPU ?????????????????????????
? (Control Flow) - Variables (??????) ?????????????????????????
????????????????????????????????
??????????????????????? A 2 5 - Algorithms ?????????????????????????????
????????????? ??????? ???????
3- Function ??????????? algorithm
?????????????????????????? ???????????????????????
??????????????????????????????????????????????????
???????? ???? Sqrt(4) -gt 2 - Subroutines,
Procedures, routines ??????????? algorithm
?????????????????????????? ????????? Subroutines
??????????????????????????????????????????????????
?????????????????????????? DO_REPORT()
???????????????????? ?????????????????????????????
????? ????????????????????????? ????? (Reuse)
4Two approaches to Programming
- Structured Programming ??????????????????????????
?????????????? top-down design ???????????????????
????????? ????????????????? ??????????????????????
????????????????????????? - Object-oriented Programming ?????????????????????
??????????????? ?????????????????????????
??????????????????????????????????????
??????????????????????????????????????????????????
???????????????
5(No Transcript)
6 Structure Programming (1960)
???????????????????????? 3 ????????????????
7(No Transcript)
8Object-oriented Programming
- ????????????????????????????????????
????????????????????????? ????????????????????????
?????????????? ???????????????????????????????????
???????????????????????? - ??????? ????????????????????????????????????????
????????????????????????????????????????? object
Data(Properties) Function (Method)
Encapsulate() - Class ??????? ???????????????????????????????????
?????????????????????? - Instance ??????????????????????????????????
????????????? Class
9Object-oriented Programming
- ????? (Object) ??????????1. Attributes
????????????????? - 2. Functions ?????????????????
- 3. Encapsulates ?????????????????????????????????
?????????????????????????????? (Property
Method)
10Instance
Class
11Inheritance ??????????? class ?????????????
Class ????????????? ??????????????????????? class
????????????????????? class ????????????
12(No Transcript)
13(No Transcript)
14- ???????????????????????????????????The Evolution
of Programming Languages - ???????????? 1 Machine Language
- ??????????????????? ??????? ???? ??????
(A A 6) ??? 10010010 ???????
15???????????????????????????????????
- ???????????? 2 Assembly Language
- ?????????????????????? ???????
?????????????????????????????? ???? add ax,6
??????? 10010010 (AX AX 6)
16???????????????????????????????????
- ???????????? 3 Higher-level Language
- ??????????????????? ?????????????????????????????
??????? ???????????????? ??????? ???????
?????????
17???????????????????????????????????
- 1. Fortran (Formula Translator)
??????????????????????????? ???????????????
Mainframe - 2. COBOL (Common Business Oriented Language)
??????????????????????????????????? ?????????,
?????? - 3. BASIC (Beginner All-purpose Symbolic
Instruction code) ?????????????????????????????
??????????????
18???????????????????????????????????
- 4. Pascal ?????????????????????????????
?????????????? - 5. C ??????????? portable ????????????????????????
?????????????????????????????? PC, Mainframe,
Mini - 6. C ???? OOP ??????????? C
- 7. Java ???? OOP ??????????? C
????????????????????????????????? - 8. C ???? OOP ??????????? C
??????????????????????????????????????????????????
19???????????? 4
- ????????????????????????????????????????????????
???????????????????????????????
?????????????????????????? ???????
??????????????? - 1. Visual Basic
- 2. SQL Select from customer where nameJohn
20???????????? 5
- ??????????????????????????????????????????????????
??????????????????????????????????? - ???????????????????? (Voice recognition)
- ??????????????????????????????????????????????????
? (Artificial Intelligence), Expert System
21?????? (Flow chart) ???????????????????????????
????????????????????????????? ????????????????????
?????????????????????????????? ???????????????????
????????? ????????????????????????????????? ANSI
??????????????????????????????????????? (Top-down
design) ????????????????, ?????????
22?????? (Flow chart)
?????????? N ????? M
MOVE N TO M
PAYHOURS5
?? 5 ??? HOURS ????????????????? PAY
????????? M ????????? 0
M 0
23?????? (Flow chart)
- ?????????????-????????????
???????????????????
Read sale-file
??????????????????????
Write Print-Record
24?????? (Flow chart)
??????????????????????????
PayHours5
PayHours5
25?????? (Flow chart)
????????????????????? ????????????????????????????
??????? ????????????
??????????????????? ????????????????????????
A
B
??????????????????? ???????????????
2
26?????? (Flow chart)
????????????????????????????????????????
??????????????????????????
START
?????????????????????????
STOP
?????????????????????????????????????
Write-Heading
???????????????????????????????????????
27??????????????? 1. ?????????????????????
?????????????????? 2. ?????????????
????????????????? 3. ??????????
??????????????????????????????????????????????????
??? 4. ???????????? ?????????????????????????????
???????????????????????????????????????????? 5.
??????????????? ??????????????????????????????????
????????????????????????? ????????????????????????
?? (????????????? Flow Chart)
28????????????????????????????????
- ?????????.?. ?????????????????????????????????????
?????????????? (Development of Information
System)
29??????????? 1 ????????????????????????
- 1. ????????????????????? ??????? 22/7RR
- 2. ????????????? The area of circle is xxxx
- 3. ?????????? ?????
- 4. ???????????? Area ???????, R ?????
305.1) ????????? R
5.2) ???????? Area 22/7RR
5.3) ????? The area of circle is , Area
5.4) ??????????
31- 5. ??????????????? (?????????????????? R lt 0)
5.1) ????????? R
5.2) ??? R lt 0 ???????????????????? _____
??? R gt 0 ???????????????????? _____
5.3) ???????? Area 22/7RR
5.4) ????? The area of circle is , Area
5.5) ??????????????? _____
5.6) ??????????
32??????????? 2 ?????????????????????????
- 1. ????????????????????? ?????? ??????
??????????????? ???????????? lt 40,
?????????????150??? ???????????? gt 40,
?????????????????? 1.5 ???? - 2. ????????????? Your have xxxx bath
- 3. ?????????? ????????????
- 4. ???????????? Pay ??????, Hours ????????????
335.1) ????????? Hours
5.2) ??? Hours lt 40, Pay Hours 150 ??? Hours
gt 40, Pay (40150) (Hours -40)1501.5
5.3) ????? Your have , pay , bath
5.4) ??????????
34- 5. ??????????????? (?????????????????? Hours lt 0)
5.1) ????????? ????????????
5.2) ??? Hours lt 0 ???????????????????? _____
??? Hours gt 0 ???????????????????? _____
5.3) ??? Hours lt 40, Pay Hours 150 ??? Hours
gt 40, Hours (40150) (Hours -40)1501.5
5.4) ????? Your have , pay , bath
5.5) ??????????????? ______
5.6) ??????????
35??????????? 3 ????.?. 2 ????????????????????????
??????????????????????? ?????????????????????
36??????????? 4 ?????????????????????? CS201
- 1. ????????????????????? 1.1) ???? ????????
????? ??? ????? ???????????????????????????
????? gt 80 ???? A ??? ????? gt 70 ???? B ???
????? gt 60 ???? C ??? ????? gt 50 ???? D ???
????? gt 0 ???? F
37- 2. ????????????? Name your grade is x
- 3. ?????????? ????, ??????????,???????,???????
- 4. ???????????? Grade ????, Total ?????Mid
??????????,Final ???????Test???????, Name
????
385.1) ????????? Name, Mid, Final, Test
5.2) ???????? Total Mid Final Test
5.2) ??? Total gt 80 , Grade A ??? Total gt
70 , Grade B ??? Total gt 60 , Grade C
??? Total gt 50 , Grade D ??? Total gt 0 ,
Grade F
5.3) ????? Name, your grade is , Grade
5.4) ??????????
39- 5. ??????????????? (?????????????????? Mid lt 0)
5.1) ????????? Name, Mid, Final, Test
5.2) ??? Mid lt0 ????????????????? _____ ??? Mid
gt0 ????????????????? _____
5.3) ???????? Total Mid Final Test
5.4) ??? Total gt 80 , Grade A ??? Total gt
70 , Grade B ??? Total gt 60 , Grade C
??? Total gt 50 , Grade D ??? Total gt 0 ,
Grade F
405.5) ????? Name, your grade is , Grade
5.7) ??????????????? ____
5.6) ??????????
41Ex 1
42Ex 2
43Ex 3
44Ex 4.1
45Ex 4.2
46??????????????????????????
- 1.??????????????? (Program Analysis)
- 2.??????????????????????? (Program Design)
- 3.??????????????? (Program Coding)
- 4.??????????????????????? (Program Testing
Verification) - 5.?????????????? ?????????????????
(Documentation Maintenance)
47??????????????? (Program Analysis)
- ??????????????????? (Whats a client want?)
- ?????????????????? (Output)
- ??????????????? (Input)
- ???????????????????????? (Variables)
48???????????????????????(Program Design)
- ??????????????????????? ??????????????????????????
???????????????????????????????? (Input)
????????? (Output) ???????????????? (Storing)
?????????????? ???????????????????????????????????
?????? (Process) - ??????????????????????????????????????????????????
?????? (Flowchart)
49???????????????????????????(Process Description)
- Pseudo Code ??????????????????????????????????????
???????? ????????? ?????? ?????????????????????? - Flow Chart ??????????????????????????????
???????????? ????????????????? ???????????????????
???
50Pseudo Code (Example)
- Accept Input Data into the system
- Store the Input Data
- Calculate the Data
- Display the Outcome on the screen
51Flow Chart
- Start/Stop a program
- Process ??????????????????
- Decision -?????/????????/????????
52Flow Chart (???)
- Input/Output-??????/??????????
- Onpage Connector-?????????????????????????????????
(??????????????????????????)
53Flow Chart (???)
- Offpage Connector-?????????????????????????????
(????????????????????????????????) - Direction-??????
54??????????????? (Program Coding)
- ???????????????????
- ????????????????? ?????????????????????????
(????????) ?????????????????? ????????????????????
??????????? ???????????????????????????????
55??????????????????????? (Program Testing
Verification)
- ???????????????????????????????????????
?????????????????????????????????????????
???????????????????????????????????????
56??????????? (Errors)
- Syntax Error ?????????????????????????????????????
????????????????????? ???? Writeln( ) ????
Writeline( ) - Logic Error ??????????????????????????????????????
???????????????????????????? (????????????????????
) - System Design Error ??????????????????????????????
?????????????????????????????????????????
57??????????????????????????????
- Desk-Checking ????????????????????????????????????
?? ????????????????????????????
Structured-Walkthrough - Translating ??????????????????????????????????????
?????????????? (Translator) ???????????
58?????????????????????????????? (???)
- Debugging ??????????????????????????
???????????????????? ???? ????????????????????????
?????? ?????????????????? Logic Errors
????????????????????????????????????????????
System Design Errors ???
59?????????????? ?????????????????(Documentation
Maintenance)
- ???????????????? ????????????????????/ ???????
?????? - ???????????????????????????????????
- System Manual --gt ??????????????????/
??????? - ?????????????????????????? / ???????
- User Manual --gt ???????????????? /
???????
60?????????????? ?????????????????(Documentation
Maintenance) (???)
- ??????????????????????????????????
- ??????????????? ?????????????????????? (Online
Manual)