Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Algorithm Design Skills and Object Oriented Paradigms | MAT 2170, Lab Reports of Computer Science

Material Type: Lab; Professor: Mertz; Class: Computer Science I; Subject: Mathematics; University: Eastern Illinois University; Term: Spring 2009;

Typology: Lab Reports

Pre 2010

Uploaded on 07/28/2009

koofers-user-sop
koofers-user-sop 🇺🇸

3

(1)

10 documents

1 / 38

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Mat 2170
WEEK 1
Drs. N. Van Cleave & A. Mertz
Spring 2009
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26

Partial preview of the text

Download Algorithm Design Skills and Object Oriented Paradigms | MAT 2170 and more Lab Reports Computer Science in PDF only on Docsity!

Mat 2170

WEEK 1

Drs. N. Van Cleave & A. Mertz

Spring 2009

Mat2170 Course Goals

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

Week 1 Student Responsibilities

I (^) Reading: Textbook, Chapters 1 and 2.

I (^) Lab: Lab 1, Prelab, & Postlab

I (^) Submissions: electronic, printouts, and web publishing

I (^) Attendance: lecture & lab

Week One Topics

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

The Programming Process

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

Stages in the “Classic” Compilation Process

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

The Interpreter Process

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 & a Hybrid Strategy

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.

Stages in Running a Java Program

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

What you’ll need in lab to program in Java:

  1. An account on the mathvnc server, issued in class
  2. Your userid and password
  3. A terminal window, from which we can direct commands to the computer system
  4. The ACM graphics library: acm.jar
  5. A way to create the programs with an editor: netbeans
  6. The java interpreter: JDK
  7. A web browser: firefox
  8. A way to transfer files from your account on the mathvnc server to your EIU student account: websync

Directory Structure in Linux

created by mkdir

created by netbeans

HelloProgram

dist

HelloProgram.class

classes

build src

HelloProgram.java

lab

HelloProgram.jar

acmLibrary

jsbach

Directory Structure in Your EIU Account

HelloProgram.html HelloProgram.jar acmLibrary.jar

http

index.html

jsbach

Directory Structure in EIU Account after Lab 1

http

index.html HelloProgram.html HelloProgram.jar Add2Integers.html Add2Integers.html acmLibrary.jar

jsbach

A Few Common Linux Commands

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