






























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Material Type: Lab; Professor: Mertz; Class: Computer Science I; Subject: Mathematics; University: Eastern Illinois University; Term: Spring 2009;
Typology: Lab Reports
1 / 38
This page cannot be seen from the preview
Don't miss anything!
Drs. N. Van Cleave & A. Mertz
Spring 2009
I (^) Develop Algorithm Design Skills: writing step-by-step instructions to solve problems
I (^) Develop Facility with the Object Oriented Paradigm: using, extending, and developing Classes and Objects
I (^) Learn a Subset of the Syntax of the Java language: be capable of writing significant Java programs
I (^) Develop Critical Thinking Skills: the processes of discernment, analysis and evaluation of information
I (^) Reading: Textbook, Chapters 1 and 2.
I (^) Lab: Lab 1, Prelab, & Postlab
I (^) Submissions: electronic, printouts, and web publishing
I (^) Attendance: lecture & lab
I (^) Getting ready for Lab 1: I (^) Algorithms I (^) The Programming Process I (^) Java I (^) The Mathematics and Computer Science lab I (^) Hello World Program
I (^) What is Computer Science?
I (^) Computer Hardware
I (^) Algorithmic Design I (^) Specifications – required I/O, types, restrictions I (^) Test Suite – well-selected inputs with expected outputs I (^) Logic which solves problem (human readable) I (^) General (Outline) I (^) Detailed
I (^) Coding I (^) Translating Detailed algorithm into computer language (JAVA) I (^) Debugging – locating and eliminating errors I (^) Maintenance – evolution of program over time
Translating code into machine language
#include <stdio.h> main() {printf("Hello\n"); } compiler
(^01001001010110010001000010100011101011) 0110100111010101100
(^10010110101100010110100100101001011011) 0101101011010100101
(^01001001010110010001000010100011101011) (^01101001110101011001001011010110001011) (^01001001010010110110101101011010100101)
source file object file
linker
executable file
files/librariesother object
Translate code into a machine–independent intermediate language
I (^) An interpreter for any given machine architecture translates source code into an intermediate language on that machine.
I (^) The interpreter simulates instructions by performing operations that have the same effect.
I (^) No separate executable file is produced — the interpreter translates and executes at the same time.
Java combines the functions of a compiler and an interpreter
I (^) Initial compilation phase: translates program into a common intermediate language, independent of underlying hardware.
I (^) The intermediate code is stored in files called: class files.
I (^) Class files are combined with other class files and libraries to produce a complete version of the intermediate program with everything it needs linked together.
I (^) Usual format for the resulting program is a compressed collection of individual files called a JAR archive.
compilerJava
Machine^ VirtualJava
CA FE BA BE 00 03 0000 16 07 00 1A 07 0000 04 00 07 0C 00 13 01 00 16 28 4C 6A 6147 72 61 70 68 69 63
CA 0000 FE BA16 0704 00 BE 0007 00 1A0C (^030700 ) 0147 00 1672 61 2870 4C 68 6A 69 6163
import acm.program.*;
}
public class Add2 ext
}
int n1 = readInt("Entprintln("This progr
public void run() { int n2 = readInt("Entint total = n1 + n2; println("The total is
2D 1400 00 1F0A 0018 0C 080200 000017 0F 0800 07 0A1C
class file
files/libraries
Java source file
other class
linker
JAR archive
14 0A 00 02 00 08 0A2D 00 1F 08 00 0F 0700 18 0C 00 17 00 1C
created by mkdir
created by netbeans
HelloProgram
dist
HelloProgram.class
classes
build src
HelloProgram.java
lab
HelloProgram.jar
acmLibrary
jsbach
HelloProgram.html HelloProgram.jar acmLibrary.jar
http
index.html
jsbach
http
index.html HelloProgram.html HelloProgram.jar Add2Integers.html Add2Integers.html acmLibrary.jar
jsbach
pwd Display current path pwd Shows where you are in file structure ls List directory contents ls list contents of current directory ls -l long version, gives more info mkdir Make Directory mkdir acmLibrary create the directory acmLibrary in the current directory