cs115_10f_Lec2

上传人:pu****.1 文档编号:586613864 上传时间:2024-09-05 格式:PPT 页数:17 大小:2.18MB
返回 下载 相关 举报
cs115_10f_Lec2_第1页
第1页 / 共17页
cs115_10f_Lec2_第2页
第2页 / 共17页
cs115_10f_Lec2_第3页
第3页 / 共17页
cs115_10f_Lec2_第4页
第4页 / 共17页
cs115_10f_Lec2_第5页
第5页 / 共17页
点击查看更多>>
资源描述

《cs115_10f_Lec2》由会员分享,可在线阅读,更多相关《cs115_10f_Lec2(17页珍藏版)》请在金锄头文库上搜索。

1、Course Calendar PseudocodeWhat is it?Why do we need it?Intro to Java programming languageFirst command line programHow do we write a command line program?How do we run a command line program? EclipseDepartment of Computer ScienceCS 115Copyright2010 by Vida WinansExpresses a programs order of instruc

2、tions in English or native language (p. 23, text)Take pseudocode and write in a programming language“Simon says” gameDepartment of Computer ScienceCS 115Copyright2010 by Vida WinansTo execute a program:Computer must be able to “read” instructionsComputer must be able to understand instructions (term

3、inology)Computer must be able to perform instructionsDepartment of Computer ScienceCS 115Copyright2010 by Vida WinansUse a language the computer understands (C, C+, Java, Basic, Fortran, Cobol, Perl, assembly, machine)Each language has a very specific syntaxThe computer knows how to translate each l

4、anguage to machine code which is understandable by computersCompiledInterpretedSyntax: (tHese “ are Some examples . Of syntx errs Department of Computer ScienceCS 115Copyright2010 by Vida WinansHigh level language: more like EnglishVery readableLow level language: more machine language (use numbers

5、instead of naming variables, very limited vocabulary) Not very readable Example: assembly languageHigh level language - compiled/interpreted - machine codeComputer can execute machine codeDepartment of Computer ScienceCS 115Copyright2010 by Vida Winansmain proc mov ax,seg message mov ah,09 lea dx,me

6、ssage int 21h mov ax,4c00h int 21h main endp end main Department of Computer ScienceCS 115Copyright2010 by Vida WinansCompiler converts high level language code (source code) to machine code Usually an intermediate file is created called object code (*.obj)Intermediate file is “linked” to other part

7、s of the program - executable file (*.exe) Executable file can be “run”Interpreter converts high level language code to machine code line by line at execution timeDepartment of Computer ScienceCS 115Copyright2010 by Vida WinansCombination of compiler/interpreterJava source code - byte codes (*.class

8、)javac is command to java compilerByte codes are usually platform-neutralByte codes - interpreted line by line at execution time by JVM (Java Virtual Machine) Department of Computer ScienceCS 115Copyright2010 by Vida Winans*.java*.classDepartment of Computer ScienceCS 115Copyright2010 by Vida Winans

9、Syntax: rules for constructing languagesSentence structureVocabularyPunctuationComputer looks for very specific words, order of words & symbols Anything unexpected: syntax error (compiler finds these)Department of Computer ScienceCS 115Copyright2010 by Vida WinansSometimes it cant! - Run-time errorC

10、omputer has erroneous output - logic errorBoth of the above are usually human errors (programmer error!)Humans must learn the syntax of a language & how to correctly express instructions so the computer can perform the necessary tasks.Most of the time the computer can perform the requested tasks.Dep

11、artment of Computer ScienceCS 115Copyright2010 by Vida WinansOpen Text editor: NotepadType following into editor: class WinansFirstProgram public static void main(String args) System.out.println(“Vidas First program”); Save file as: WinansFirstProgram.javaCompile program: javac WinansFirstProgram.ja

12、vaLook in directory to see WinansFirstProgram.class fileRun program: java WinansFirstProgramWhat is your result? Department of Computer ScienceCS 115Copyright2010 by Vida WinansIntegrated Development EnvironmentAllows programmers to focus on the programmingIdentifies syntax errorsSuggests Quick Fixe

13、s for errorsCompiles and runs programs with a single clickAllows overall view of programDebug feature Department of Computer ScienceCS 115Copyright2010 by Vida WinansSee instructions posted in BB - Weekly Assignments - Helpful Hints - Using EclipseFollow instructions to run your first Eclipse progra

14、m Department of Computer ScienceCS 115Copyright2010 by Vida WinansDownload survey in BB - Weekly Assignments Complete information and submit to BB where the survey was downloadedCredit as Lecture Activity given for submission by due date.Department of Computer ScienceCS 115Copyright2010 by Vida WinansCan define pseudocodeCan write pseudocodeUnderstand how a computer can “read” a programming languageCompiled, interpretedCan write and run a command line programCan start Eclipse IDEDepartment of Computer ScienceCS 115Copyright2010 by Vida Winans

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 建筑/环境 > 施工组织

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号