Introduction to CS Welcome to CS 5 !

Download Report

Transcript Introduction to CS Welcome to CS 5 !

Welcome to CS 5 !

Introduction to CS

an advocate of concrete computing

Of all the classes I took, this was one of them.

When CS 5 was over, I knew it was a good thing.

Ebert and Roeper’s course reviews

Meeting Times and Places

Lab

Required !

M and W: T and Th:

4-5 pm in the Academic Computing (AC) Labs 2:30-3:30 pm AC Labs are in Parsons 146 Chance to work on HW problems & ask questions Alternate using the Macs and the PCs .

Mac: A-J PC: M-Z by last name alternating each week...

Meeting Times and Places

Lab

Required !

Lecture

Strongly encouraged

M and W: T and Th:

4-5 pm in the Academic Computing (AC) Labs 2:30-3:30 pm AC Labs are in Parsons 146 Chance to work on HW problems & ask questions Alternate using the Macs and the PCs .

Mac: A-J PC: M-Z by last name alternating each week...

M and W: T and Th:

2:45-4:00 pm (or so) here in Galileo Pryne 1:15-2:30 pm (or so) here in Galileo Pryne Insight into the HW problems (what, why, how)

Meeting Times and Places

Lab

Required !

Lecture

Strongly encouraged

M and W: T and Th:

4-5 pm in the Academic Computing (AC) Labs 2:30-3:30 pm AC Labs are in Parsons 146 Chance to work on HW problems & ask questions Alternate using the Macs and the PCs .

Mac: A-J PC: M-Z by last name alternating each week...

M and W: T and Th:

2:45-4:00 pm (or so) here in Galileo Pryne 1:15-2:30 pm (or so) here in Galileo Pryne Insight into the HW problems (what, why, how)

Recitation

All are welcome 8:00 - 9:00 am Fridays in Galileo Edwards More insight into the HW problems (

how

)

NO recitation this week -- it’s for Monday’s section only!

Resources

Course Web Page:

http://www.cs.hmc.edu/courses/2004/fall/cs5

all assignments, online text, necessary files, lecture slides are here First week’s assignment: Reading Wk 1 and starting on Hw 2.

Resources

Course Web Page:

http://www.cs.hmc.edu/courses/2004/fall/cs5

all assignments, online text, necessary files, lecture slides are here First week’s assignment: Reading Wk 1 and starting on Hw 2.

Course Mailing List reminders and hints CS 5 vs. spam!

Resources

Course Web Page:

http://www.cs.hmc.edu/courses/2004/fall/cs5

all assignments, online text, necessary files, lecture slides are here First week’s assignment: Reading Wk 1 and starting on Hw 2.

Course Mailing List reminders and hints CS 5 vs. spam!

Old Compiler:

CodeWarrior

Learning Edition 3.0 $35

that smile... ?!

Resources

Course Web Page: http://www.cs.hmc.edu/courses/2004/fall/cs5/ all assignments, online text, necessary files, lecture slides are linked First week’s assignment: Reading Wk 1 and starting on HW 2.

Course Mailing List reminders and hints XCode - Mac Compiler:

JCreator

or

XCode/Proj. Builder

Price: $0 !

With many other advantages, as well...

available from www.cs.hmc.edu/~dodds/cs5 JCreator - PC

Homework

Assignments 4-5 problems (50 points) per week, 20% extra credit Monday’s section Tuesday’s section Wednesday’s section Thursday’s section due Sunday 11:59 pm due Monday 11:59 pm Working on programs: save in your CHARLIE home directory

(H:)

saving on the

C:

drive is OK on

your machine

, of course! Submitting Programs: on line from the course website Working on different machines:

submit

These are all available from the CS 5 website ( and

download

You’ll need the supporting files for each machine you’ll be using

Hw2Pr1.zip

, etc.)

Grading

Grades Based on points percentage ~ 50% Assignments ~ 30% Exams ~ 20% Participation

if (score >= 95%) {grade = “A”;} if (score >= 95%) {grade = “HP”;} if (score >= 60%) {grade = “P”;}

see course syllabus for the full grade list...

Grading

Grades Based on points percentage ~ 50% Assignments ~ 30% Exams ~ 20% Participation Exams

if (score >= 95%) {grade = “A”;} if (score >= 95%) {grade = “HP”;} if (score >= 60%) {grade = “P”;}

see course syllabus for the full grade list...

Midterm #1 Friday, October 8 Midterm #2 Friday, November 12 Final To be announced 50 points each 300 points

if (currentgrade == “A”) { takeexam = false; }

Grading

Grades Based on points percentage ~ 50% Assignments ~ 30% Exams ~ 20% Participation Exams

if (score >= 95%) {grade = “A”;} if (score >= 95%) {grade = “HP”;} if (score >= 60%) {grade = “P”;}

see course syllabus for the full grade list...

Midterm #1 Friday, October 8 Midterm #2 Friday, November 12 Final To be announced 50 points each 300 points

if (currentgrade == “A”) { takeexam = false; }

Already know programming …? Work ahead!

You may submit assignments 5, 10, and 14 instead of an earlier assignment. If you receive at least an 80%, those lab sessions are not required, and you will receive the same grade on the intervening hwks.

but email me if you do this...

Resources

Instructors Zach Dodds Belinda Thom Office: Olin 1265 Olin 1241 Phone: x78990 (909-607-8990) x79662 Email: [email protected] [email protected]

Official Office Hrs: F 9-12 TTh 4:30-6 Real Office Hrs: come by anytime… Graders

/

Tutors

available in the LAC and Parsons computer labs

• during afternoon lab sessions • Saturday and Sunday afternoons • Sunday and Monday evenings • you can also track them down elsewhere... names linked from the webpage Other Students The Honor Code and Computer Science...

Honor Code • You are

encouraged

with other students.

to

discuss

problems • You may verbal solutions with other students (present or past):

not

share written, electronic or

No copying of files except those provided by the course material.

No transcribing of programs from paper, whiteboards, blackboards, or other media. Starting with week 3 (Hw3), you will have the option of working in pairs for one of each week’s problems. (The same guidelines apply for each pair.)

Questions ?

Welcome to CS 5 !

an advocate of concrete computing

Introduction to CS

Of all the classes I took, CS 5 was one of them.

When CS 5 was over, I knew it was a good thing.

Not as poignant as Jason vs. Freddy, but at least as gory!

Ebert and Roeper’s course reviews

Welcome to CS 5 !

an advocate of concrete computing

Computer Psychology

Of all the classes I took, CS 5 was one of them.

When CS 5 was over, I knew it was a good thing.

Not as poignant as Jason vs. Freddy, but at least as gory!

Ebert and Roeper’s course reviews

Goals

class S{public static void main(String[]a){String s= "class S{public static void main(String[]a){String s= ;char c=34;System.out.println(s.substring(0,52)+c+s +c+s.substring(52));}}” ;char c=34;System.out.println(s.substring(0,52)+c+s +c+s.substring(52));}} ouch!

Goals

class S{public static void main(String[]a){String s= "class S{public static void main(String[]a){String s= ;char c=34;System.out.println(s.substring(0,52)+c+s +c+s.substring(52));}}” ;char c=34;System.out.println(s.substring(0,52)+c+s +c+s.substring(52));}} ENIAC, 1945 ouch!

thinking like a machine

Not why...

Java is the programming language of the future Programming will solve problems for you Programming will save time && effort

Not why...

Java is the programming language of the future Programming will solve problems for you Programming will save time && effort 2 ampersands in Java ( && ) means

and

Why ?

Science is about explaining and understanding data. Computer Science provides powerful tools to do this.

simulation http://heat.usc.edu/test/new/HSgas.html

N-body problem analysis How do we represent physical phenomena … ?

How does each object affect others … ?

How many forces do we need to keep track of … ?

Why Java ?

Java is a

general-purpose

Engineering: computer language laser-testing code in LabView Matlab, Electric, E4 Physics: Chemistry: LabView Rasmol, Kaleidograph Math: Biology: Maple, ODE Architect Populus, Lasergene & lots more special-purpose packages sequence-matching in Lasergene

But ...

I can be a physicist, chemist, engineer, biologist, mathematician, high-school teacher, Fear Factor contestant, or CEO of the next Microsoft, ...

without

programming || computer science

But ...

I can be a physicist, chemist, engineer, biologist, mathematician, high-school teacher, Fear Factor contestant, or CEO of the next Microsoft, ...

without

programming || computer science or

But ...

I can be a physicist, chemist, engineer, biologist, mathematician, high-school teacher, Fear Factor contestant, or CEO of the next Microsoft, ...

without

programming || computer science Yes, if you’re 60 Maybe, if you’re 20 But ... intuition about the machines you’ll be using will make you

more effective

at all of the above.

What is programming ?

Programming == recipe-writing

What is programming ?

Programming == recipe-writing is

What is programming ?

Programming == recipe-writing Programming == learning a foreign language

What is programming ?

Programming == recipe-writing Programming == learning a foreign language

Baggage !

What is programming ?

Programming == recipe-writing Programming == learning a foreign language Baggage !

class CS5App { public static void main(String[] args) { System.out.println("Hello World!"); } }

What is programming ?

Programming == recipe-writing Programming == learning a foreign language Baggage !

class CS5App { public static void main(String[] args) { System.out.println("Hello World!"); } }

Syntax:

What is programming ?

Programming == recipe-writing Programming == learning a foreign language Baggage !

class CS5App { {

week 13 week 10 week 5 week 2 week 7 week 2

public static void main(String[] args) System.out.println("Hello World!"); } }

What

is

all of this stuff ?

&& Why is it here ?

go/went

Java baggage #1 -- Punctuation

/* A Hello, World program */ class CS5App { public static void main(String[] args) // start here { System.out.println(" Hello World!

"); } }

Java baggage #1 -- Punctuation

/* A Hello, World program */ class CS5App { public static void main(String[] args) // start here { System.out.println(" Hello World!

"); } }

Punctuation: { curly braces create code blocks } matched

Java baggage #1 -- Punctuation

/* A Hello, World program */ class CS5App { public static void main(String[] args) // start here { System.out.println(" Hello World!

"); } }

Punctuation: matched

.

;

the “dot” indicates containment a semicolon ends a statement unmatched

Java baggage #2 -- Comments

/* A Hello, World program */ class CS5App { public static void main(String[] args) // start here { System.out.println("Hello World!"); } }

Two types of comments:

// rest-of-line comment /* one-or-more-line comment */

Java baggage #3 -- Spacing

/* A Hello, World program */ class CS5App { public static void main(String[] args) // start here { System.out.println("Hello World!"); } }

programs that look identical to Java...

/* A Hello, World program */ class CS5App { public static void main(String[] args){ //starthere System.out.println( "Hello World!") ;}}

Java baggage #3 -- Spacing

/* A Hello, World program */ class CS5App { public static void main(String[] args) // start here { System.out.println("Hello World!"); } }

3. Spacing almost completely

ignored

by silicon almost completely

essential

for carbon

these

1. aligning punctuation 2. commenting 3. adequate spacing are the essential style guidelines

If you don’t space...

riverrunpastEveandAdamfromsw erveofshoretobendofbaybringsusb yacommodiusvicusofrecirculation backtoHowthCastleandEnvirons.

If you don’t space...

riverrunpastEveandAdamfromsw erveofshoretobendofbaybringsusb yacommodiusvicusofrecirculation backtoHowthCastleandEnvirons.

riverrun past Eve and Adam from swerve of shore to bend of bay brings us by a commodius vicus of recirculation back to Howth Castle and Environs.

James Joyce

Java baggage #4 --

main /* A Hello, World program */ class CS5App { public static void main (String[] args) // start here { System.out.println("Harvey"); System.out.print(“Mu"); } } main

is where it all begins...

Java baggage #5 -- Printing

/* A Hello, World program */ class CS5App { public static void main(String[] args) // start here { System.out.println("Harvey"); System.out.print(“Mu"); } }

text output

H.out.println(“dd”); H.out.print(“col”); H.p(“leg”); H.pl(“e”);

Java baggage #5 -- Printing

/* A Hello, World program */ class CS5App { public static void main(String[] args) // start here { System.out.println("Harvey"); System.out.print(“Mu"); } } System.out

H.out

H

are all basically the same.

H.out.println(“dd”); H.out.print(“col”); H.p(“leg”); H.pl(“e”);

Java baggage #5 -- Printing

/* A Hello, World program */ class CS5App { public static void main(String[] args) // start here { System.out.println("Harvey"); System.out.print(“Mu"); } } System.out

H.out

H

are all basically the same.

So, use

H

!

H.out.println(“dd”); H.out.print(“col”); H.p(“leg”); H.pl(“e”);

Java baggage #5 -- Printing

/* A Hello, World program */ class CS5App { public static void main(String[] args) // start here { System.out.println("Harvey"); System.out.print(“Mu"); } }

goes to next line at end stays on same line at end stays on same line at end goes to next line at end

H.out.println(“dd”); H.out.print(“col”); H.p(“leg”); H.pl(“e”); \n

puts a new line anywhere

If Joyce wrote in code...

For example,

H.out.print(“hvm\naeu\nryd”); H.out.println(“whteu\naerae”); H.out.print(“vyrao\noeg”); H.out.println(“dn\nbooe.”);

If Joyce wrote in code...

For example,

H.p(“hvm\naeu\nryd”); H.pl(“whteu\naerae”); H.p(“vyrao\noeg”); H.pl(“dn\nbooe.”);

Language is language

PLEASE DO ,1 <- #13 DO ,1 SUB #1 <- #238 DO ,1 SUB #2 <- #112 DO ,1 SUB #3 <- #112 DO ,1 SUB #4 <- #0 DO ,1 SUB #5 <- #64 DO ,1 SUB #6 <- #238 DO ,1 SUB #7 <- #26 DO ,1 SUB #8 <- #248 DO ,1 SUB #9 <- #168 DO ,1 SUB #10 <- #24 DO ,1 SUB #11 <- #16 DO ,1 SUB #12 <- #158 DO ,1 SUB #13 <- #52 PLEASE READ OUT ,1 PLEASE GIVE UP

Intercal

,: ^_25*,@ v >v"Hello world!"0<

Befunge LISP/Scheme

(DEFUN HELLO-WORLD () (PRINT (LIST 'HELLO 'WORLD))) #include int main() { std::cout << "Hello, world!"; }

C++

print "Hello, World!";

Perl

Language is language ?

Perls of wisdom ?

eval evalq.q>trd!Uj:%L<061:%C

odv),idhfiu

sddo5(:S)1(:%b,?sdqd`u)%I-]'t(:%t,?choe)&=Envo?&

z%b,?bsd`udUdyu)%L-9,udyu^chr($$/$$)x2016.

$;=$_;$/='0#](.+,a()$=(\}$+_c2$sdl[h*du,(1ri)b$2](n}/1)1tfz),}0( o{=4s)1rs(2u;2(u",bw2b$hc7s"tlio,tx[{ls9r11$e(1(9]q($,$2)=)_5{4* s{[9$,lh$2,_.(ia]7[11f=*2308t$$)]4,;d/{}83f,)s,65o@*ui),rt$bn;5( =_stf*0l[t(o$.o$rsrt.c!(i([$a]$n$2ql/d(l])t2,$.+{i)$_.$zm+n[6t(e 1+26[$;)+]61_l*,*)],(41${/@20)/z1_0+=)(2,,4c*2)\5,h$4;$91r_,pa,) $[4r)$=_$6i}tc}!,n}[h$]$t0rd)_$';open(eval$/);$_=<0>;for($x=2;$x <666;$a.=++$x){s}{{.|.}};push@@,$&;$x==5?$z=$a:++$}}for(++$/..su

bstr($a,1885)){$p+=7;$;.=$@[$p%substr($a,$!,3)+11]}eval$; back to Java

The Plan

Representation

Naming things

int double String boolean true false float short long char byte void Information Flow

Making decisions

if else switch case for while do return break Using/Building Structures [ ] new

Abstraction !

class private public static super

Weeks 2-6

functions, methods, variables

Weeks 3-4

conditionals, loops

Weeks 1-14

arrays, classes, design

Abstraction

Artists are mystics rather than rationalists. They leap to conclusions that logic cannot reach.

-- Sol LeWitt, conceptual artist

Simplicity does not precede complexity, but follows it.

-- Alan Perlis, creator of the first compiler

Abstract(ion) Art

class CS5App { public static void main (String[] args) { GrCanvas art = G.createCanvas(); // the window (canvas) art.add(new GrRectangle(1,3,6,4,Color.red)); // what ??

} }

Abstract Art

10 x 10 grid art.add(GrRectangle(1,3,6,2,Color.red));

Abstract Art

10 x 10 grid art.add(GrRectangle(1,3,6,2,Color.red));

Abstract Art

10 x 10 grid art.add(GrRectangle(1,3,6,2,Color.red)); art.add(GrRectangle( )); art.add(GrRectangle( ));

Assignment 2, Problem 2

Create the following “work”: art.add(new GrRectangle(…)); art.add(new GrRectangle(…)); art.add(new GrRectangle(…)); art.add(new GrRectangle(…)); …

Computer Science

Information • Representing it -- what’s convenient and available ?

• Applying it -- graphics, robotics, vision, AI • Measuring it -- what’s possible and what’s not How many drawing commands are really necessary ?

Computer Science

Information • Representing it -- what’s convenient and available ?

• Applying it -- graphics, robotics, vision, AI • Measuring it -- what’s possible and what’s not How many drawing commands are really necessary ?

23 kb file 31 kb file

In a nutshell...

The purpose of computing is insight, not numbers.

– Richard Hamming

Programming is deceptively easy.

– thanks to Steven Pinker

Mac: A-J

Lab Today

PC: M-Z Work on the problems of Homework 2 : Hw2Pr1) The “Hello, World!” program Hw2Pr2) Abstract(ion) Art Hw2Pr3) A printing puzzle...

Hw2Pr4) Artificial Intelligence

(Today) (Next week)

(or submit hw5...) Please complete your CS 5 “quiz” & take a photo… • Not an HMC student ? See me for an HMC account +

building access

“Quiz”

• Name • Birthdate • A place you consider home • Your favorite _________ is _________.

• Your least favorite ________ is _________.

• Email and School (if not an HMC student) Be sure to have a photo taken !

“Quiz”

• Name Zach Dodds • Birthdate 01/21/1969 • A place you consider home Pittsburgh, PA • Email and School (if not an HMC student) [email protected]

Questions ?

Questions ?

• How do I submit things ?

• Does CodeWarrior run from student rooms ?

• Can I work on Assignment 5 now ?

• What’s the best thing to work on in lab ?

Resources

Instructors Zach Dodds Office: Olin 1265 Phone: x78990 (909-607-8990) Email: [email protected]

Official Office Hours: F 9-12 Real Office Hours: Any time or by email...

Graders

/

Tutors

available in the LAC and Parsons computer labs

• during afternoon lab sessions • Saturday and Sunday afternoons • Sunday and Monday evenings • you can also track them down elsewhere... names linked from the webpage Other Students The Honor Code and Computer Science...

CS 5 developments

• The submission system won’t be up until September 10th...

• CodeWarrior doesn’t work from student rooms right now - likely it will be available

only from labs

for the term!

(of course if you have your own copy, it will work) • Assignments 1, 2, and 3 are ready. 4 and 5 will be by 9/12.

• Make a CS 5 folder in your KATO home directory.

Save everything there!

Stuff saved elsewhere will be lost!

Class Meetings

Lab Required ! 2:15 - 3:15 in the Academic Computing (AC) Labs Chance to work on HW problems & ask questions Alternate Mac/PCs . This week Mac: A-M PC: N-Z Kato password w/ more than 8 letters?? -- Change it on the PC!

Lecture Strongly encouraged 1:15 - 2:15 (or so) here in Galileo Pryne Insight into the HW problems (what, why, how) Recitation All are welcome 8:00 - 9:00 Fridays in Galileo Macalister More insight into the HW problems (

how

)

do NOT come this week -- it’s for Monday’s section only!

Homework

Assignments 4-5 problems (50 points) per week, 20% extra credit Monday’s section Tuesday’s section Wednesday’s section Thursday’s section due Sunday 11:59 pm due Monday 11:59 pm Grading 8 points for correctness 8 points if it completely works 6 points if it almost completely works 3 points if it mostly works 0 points if it doesn’t mostly work 2 points for commenting and formatting 0 points if the code does not compile!

Homework

Assignments 4-5 problems (50 points) per week, 20% extra credit Monday’s section Tuesday’s section Wednesday’s section Thursday’s section due Sunday 11:59 pm due Monday 11:59 pm

Alan Perlis

If a listener nods his head when you're explaining your program, wake him up. A program without a loop and a structured variable isn't worth writing. Simplicity does not precede complexity, but follows it. The goal of computation is the emulation of our synthetic abilities, not the understanding of our analytic ones. A year spent in artificial intelligence is enough to make one believe in God. You think you know when you can learn, are more sure when you can write, even more when you can teach, but certain when you can program. A programming language is low level when its programs require attention to the irrelevant.

An Education Is What Remains When We Forget Everything We've Learned An education is what remains when you’ve forgotten everything you've learned

Language is language

familiar and sometimes not so familiar… deceptively easy There’s baggage to get used to.

Java programming -- writing a recipe programming -- learning a foreign language scare you w/Hello, world in other languages… really no scarier than being raised to learn Finnish or whatever syntax hello, world static, public…

Java’s baggage

/* A Hello, World program */ class CS5App { public static void main(String[] args) // start here { H.out.println("Hello World!\nHow are you?"); H.in.nextLine(); } }

6. Input

H.in.nextLine();

worthwhile?

CGU slides

Why ?

IS is about • explaining and understanding data • leveraging technologies economically • promoting relationships with people Computer Science provides a set of tools to help.

simulation filtering communication analysis N-body problem How difficult is this?

Name calling

Weeks 2-3 Naming things Java gender -- example from book flavor (up,down,charm,strange,top,bottom) Type: integer value (

int

), sequence of characters (

String

), double-precision value (

double

), ...

Representation

Naming actions

Information Flow

mood -- Go! But if she were to go… There he goes. transitive/intransitive

H.out.println(); H.in.nextLine();

Decisions, decisions

Weeks 3-5 Java Big Idea: information flow Name things Name actions Make decisions And more of the same… intelligent?! no if…then puzzle room draw!

loop = pattern complexity reducing enough to build an intelligent agent?!

The Key

building structures out of raw actions any skilled trade building structures out of raw data any skilled trade building structures out of both actions and data it can take care of itself!

key: building things = abstraction … why? Week 5 Weeks 6-9 Weeks 10-14

Computer Science

T he science of information transistors & electrons, quantum gates and particle superpositions, recombinant molecules, analog computing • representing it -- what’s convenient for the electrons?

• changing its form -- what’s convenient for us?

programming algorithms, complexity • applying it -- AI, graphics, robotics, ...

computability • measuring it -- complexity -- what’s possible?

algorithms -- minimal number of drawing commands

Abstract(ion) Art

computer science is fundamentally a referential subject...

recognition that you don’t really need to know all the details, you just need to know where to get them and how to use them from there

Expert Advice

Get into a rut early -- do the same process the same way.

Accumulate idioms and standardize!

It is Shakepeare’s idiom list, not his vocabulary, that distinguishes him.

– Alan Perlis

If you don’t space...

riverrunpastEveandAdamfromsw erveofshoretobendofbaybringsusb yacommodiusvicusofrecirculation backtoHowthCastleandEnvirons.

If you don’t space...

riverrunpastEveandAdamfromsw erveofshoretobendofbaybringsusb yacommodiusvicusofrecirculation backtoHowthCastleandEnvirons.

riverrun past Eve and Adam from swerve of shore to bend of bay brings us by a commodius vicus of recirculation back to Howth Castle and Environs.

James Joyce

Silicon Dreams

How does a machine think ?

Silicon Dreams

How does a machine think ?

Algorithms Programming Language How many problems am I facing ?

p = 5*12;

Machine Instructions

load p 5 mult p 12

layers of abstraction Movement of electrons Shockley’s first transistor its great great-… grand child

Silicon Dreams

How does a machine think ?

Algorithms our tasks How many problems am I facing ?

Programming Language

p = 5*12;

Machine Instructions computer’s tasks layers of abstraction Movement of electrons Shockley’s first transistor

load p 5 mult p 12

Java its great great-… grand child

Silicon Dreams

How does a machine think ?

Algorithms Machine Instructions our tasks Programming Language computer’s tasks layers of abstraction Movement of electrons Shockley’s first transistor How many problems am I facing ?

program

p = 5*12;

Java compile

load p 5 mult p 12

run its great great-… grand child

10 x 10 grid

Abstract Art

mygrid.drawRect(1,2,3,4,Color.magenta);

Assignment 2, Problem 4

Create the following “work”:

g.addRect( … ); g.addRect( … ); g.addRect( … ); g.addRect( … ); …

Why ?

Science is about explaining and understanding data. Computer Science provides powerful tools to do this.

simulation

http://www.kingsu.ab.ca/~brian/proj/nbod2.html

analysis How do we represent physical phenomena … ?

How does each object affect others … ?

How many forces do we need to keep track of … ?

N-body problem

Java baggage #5 -- Printing

/* A Hello, World program */ class CS5App { public static void main(String[] args) // start here { System.out.print("Hello World!"); System.out.println("How are you?"); } } HMCSupport.out.println(“harvey”); HMCSupport.out.print(“mu”); System HMCSupport H

are all basically the same.

H.out.println(“dd”); H.out.print(“college”); H.p(“leg”); H.pl(“e”);

Java baggage #5 -- Printing

/* A Hello, World program */ class CS5App { public static void main(String[] args) // start here { System.out.print("Hello World!"); System.out.println("How are you?"); } } HMCSupport.out.println(“harvey”); HMCSupport.out.print(“mu”); System HMCSupport H

are all basically the same.

So, use

H

!

H.out.println(“dd”); H.out.print(“college”); H.p(“leg”); H.pl(“e”);

Java baggage #5 -- Printing

/* A Hello, World program */ class CS5App { public static void main(String[] args) // start here { H.p("Hello World!"); H.pl("How are you?"); } }

goes to next line at end stays on same line at end goes to next line at end stays on same line at end

H.pl(“harvey”); H.p(“mu”); H.pl(“dd”); H.p(“college”); \n

puts a new line anywhere