COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01...

45
COSC 236 Section 101 Fall 2014 Computer Science 1 -- Prof. Michael A. Soderstrand (M 4:00 – 6:40 and W 4:00 – 5:50pm)

Transcript of COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01...

Page 1: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

COSC 236 Section 101 Fall 2014Computer Science 1 -- Prof. Michael A. Soderstrand (M 4:00 – 6:40 and W 4:00 – 5:50pm)

Page 2: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

Lecture 1• Prof. Michael A. Soderstrand

[email protected]• (Note: [email protected] will redirect to my IEEE account)• 202-642-8577 (Cell)

• Lecture:• Monday 4:00 pm – 6:40 pm, Room YR 301

• Computer Laboratory:• Wednesday 4:00pm – 5:50pm, Room YR 403

• Office Hours:• Monday & Wednesday after Lecture or Laboratory or by Appointment

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

2

Page 3: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

Graded Assignments for COSC 236

• 14 In-Lab Quizzes (one each Wednesday – including today!)• 10 points each for 140 total points• You must sign in during the first 10 minutes of Lab in order to get a quiz sheet • Quiz handed out after any lecture that will begin most labs.• Quiz must be completed in Lab and demonstrated to Prof. Soderstrand.

• Nine Computer Laboratory Assignments• 40 points each for 360 total points• Due at the end of each chapter (Midnight on the Due Date)

• Midterm Exam (In-Class with Take Home Portion worth 200 points)

• Final Exam (In-class worth 300 points)

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

3

Page 4: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

Comment on Attendance

• It is very important that you do not miss any class or lecture!

• Attendance in COSC 2036 is mandatory

• The 14 Quiz computer problems will be a critical part of attendance

• You will need to sign in when you arrive in class (first 10 minutes)

• DO NOT SIGN IN FOR ANOTHER PERSON!

• Only those who sign in during the first 10 minutes of Lab will be allowed to take the Quiz

• The Quiz is due before you leave lab and must be demonstrated to Prof. Soderstrand during the lab period.

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

4

Page 5: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

Grading Scale for COSC 236

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

5

Point Total Grade Point Total Grade 970 - 1000 A+ 770 - 799 C+ 930 - 969 A 730 - 769 C 900 - 929 A- 700 - 729 C- 870 - 899 B+ 670 - 699 D+ 830 - 869 B 630 - 669 D 800 - 829 B- 600 - 629 D-

0 - 599 F

Page 6: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

6

Page 7: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

TEXTBOOK (Also available in Kindle form)

• For COSC 236 (CS-1) we will be following the text very closely• Read the text BEFORE class• My lecture will be keyed to the text

• In general, two Lectures will be each Monday with Lab on Wednesday • However, today and next Wednesday we will have one

lecture followed by lab.• There is an assessment test in the lab today• The purpose of the assessment test is to be sure you have

the background for this course• If you do not have the background, we have a course to

bring you up to speed

COSC 236 :Prof. M.A. Soderstrand Lecture 02 1/29/2014

7

Page 8: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

COSC 236 Does Not Cover the Entire Text

• This is a beginning course concentrating on procedural programming• Straight-line

• Selection

• Loops

• We will cover TEN chapters:• Chapters 1 – 8

• Chapters 12 - 13

COSC 236 :Prof. M.A. Soderstrand Lecture 02 1/29/2014

8

Page 9: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

COSC 236 Class Web Site: http://class-notes.us

Click on COSC-236

Syllabus

Schedule

Lecture Notes

Laboratory Assignment

Quiz Solutions

will Appear Here the Day After the Quiz is Completed

Page 10: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

During the Laboratory Time Today

• You will be introduced to DrJava, the Java Runtime Environment we will be using in COSC 236

• Everyone will run a simple Java program to be sure you know how to use DrJava

• Laboratory assignments will generally require you to do some of your work outside class and laboratory time

• You may use the labs on the 4th floor, YR-403 and YR-407 for this out of class work or you can download DrJava on your own computer and work at home

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

10

Page 11: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

Any Questions on Class Procedures?

OK – With all your questions answered, let’s get started!

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

11

Page 12: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

Brief History of Electronic Computers

• The First General-Purpose Electronic Computer was ENIAC• Designed at University of Pennsylvania during World War II

• Funded by United States Army Ordinance Corps to calculate artillery tables

• Public Announcement February 14, 1946

• Decommissioned October 2, 1955

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

12

Page 13: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

Brief History of Electronic Computers

• UNIVAC was the First General-Purpose Electronic Computer Designed for Business• Designed by Eckert-Mauchly Computer Corporation bought by Remington

Rand later to become Sperry and now Unisis

• First UNIVAC was accepted by US Census Bureau on March 31, 1951

• 46 UNIVACs were built ranging in price from $159k to $1.25M

• The last UNIVAC went out of service in 1970

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

13

Page 14: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

Brief History of Electronic Computers

• Control Data Corporation CDC-3600• Designed by Seymour Cray who left Sperry-Rand when they phased out their

scientific computer division in 1957

• First CDC-3600 delivered in June 1963

• First computer for Dr. Soderstrand!

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

14

Page 15: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

Brief History of Electronic Computers

• Cray Supercomputer• Designed by Seymour Cray who left Control Data Corporation to form his own

company to design a super computer.

• First Cray was delivered in 1976

• That Cray was decommissioned in 1989

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

15

CRAY 1 at Los Alamos National Labs(serial number 001)

First Mainframe Computer to use Integrated Circuits

Page 16: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

Brief History of Electronic Computers• Digital Equipment Company PDP-8 Minicomputer

• Designed by Edison de Castro who later founded Data General

• Introduced March 22, 1965

• Sold over 50,000 units

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

16

Page 17: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

Brief History of Electronic Computers• Digital Equipment Company PDP-11

Minicomputer• Most successful DEC Minicomputer

• Introduced early 1970

• Sold over 600,000 units

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

17

Page 18: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

• Digital Equipment Company VAX-11 Minicomputer• Introduced October 25, 1975• VAX has been perceived as

the quintessential CISC ISA• Last VAX sold in 2000 after

DEC was purchased by Compaq which later merged with HP

• VAX CISC architecture was superseded by RISC architecture resulting in the demise of the VAX

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

18

Brief History of Electronic Computers

Page 19: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

• Digital Equipment Company Minicomputers

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

19

Brief History of Electronic Computers

Page 20: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

Brief History of Electronic Computers• Early Micro Computers

• The first microcomputers were kits designed for hobbyists.

• The Intel 8008 processor was the first 8-bit processor replacing the 4-bit Intel 4004 released in 1971

• The Intel 8080 was an improved version of the Intel 8008

• These Intel Chips were only CPU’s, they required a kit of components around them to implement a computer.

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

20

Page 21: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

Brief History of Electronic Computers• Xerox Parc – The Alto PC

• The first personal computer was built at Xerox Parc in Palo Alto, CA in 1970

• The design was by Charles Thacker

• Over 2000 were produced for internal use at Xerox

• Alto was the inspiration for the Apple Lisa and MacIntosh after Steve Jobs visited Xerox Parc in December 1979

• Jobs took several Altos with him as Xerox had decided not to pursue the PC market

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

21

Page 22: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

Brief History of Electronic Computers

• MITS Altair 8800 – First Commercial Success!• Ed Roberts negotiated a deal with Intel for the

8080 chip in quantity at $75 per chip• He then designed a simple kit that sold for $400• Ed Roberts needed to sell 200 units to break even

and expected to sell 800 units during the launch year of 1975

• When the Altair 8800 appeared on the cover of January 1975 issue of Popular Electronics Magazine, the orders started rolling in

• By the end of January MITS had shipped over 1000 Altair 8800 kits!

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

22

Page 23: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

Brief History of Electronic Computers

• IMSAI 8080 – Second Commercial Success!• In 1974 computer consultant William Millard was contacted by General Motors to produce a workstation

• He started the design, but then General Motors backed out

• Milliard then joined with Joe Killian to form IMSAI and design a complete Intel 8080 based microcomputer

• IMSAI shipped their first unit in December 1975

• 20,000 units were ultimately sold!

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

23

Page 24: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

Brief History of Electronic Computers

• The IBM PC – A Game Changer• In August 1980 Bill Lowe of IBM Boca Raton Florida

demonstrated the first IBM PC to IBM Management• This resulted in a 13-person team to perfect the

design headed by engineer Don Estridge• The IBM PC was an “open architecture” that

encouraged other companies to provide both software and hardware for the new IBM PC

• The first IBM PC was sold in August 1981 for $1,565• The IBM PC was a spectacular success – by the end

of 1982 IBM was selling one PC every minute!• By 1984 the IBM PC had 56% of the PC market with

sales over $4 billion.

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

24

Page 25: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

25

Page 26: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

Brief History of Electronic Computers• Laptop Computers

• The first laptop computers were introduced in 1981

• The Epson HX-20

• Radio Shack TRS-80 Model 100

• HP Model 85

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

26

HP Model 85

TRS-80 Model 100

Epson HX-20

Page 27: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

Brief History of Electronic Computers

• Laptop Computers• The first laptop clam shell

models appeared in the mid 1980’s• Dulmont Magnum (1982)

• Grid Compass (1982 NASA)

• Gavalin SC (1983)

• IBM Thinkpad (1992)

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

27

Dulmont Magnum Grid Compass (NASA)

Gavalin SC IBM Thinkpad

Page 28: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

• Modern Computer Products (Apple)

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

28

iPhones

iWatch

Brief History of Electronic Computers

iPhone 5S iPhone 5C

Page 29: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

29

Brief History of Computer Software

We will be programming in Java, a subset of C# and a direct derivative of C++ and SmallTalk.

High-Level Languages

Page 30: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

30

Brief History of Computer Software

Machine Language:• Machine instructions encoded in

binary• Specific to a particular computer

Assembly Language• Mnemonics that represent

machine language• Also specific to a particular

computer

Low-Level Languages

Assembly Language programming textbook written by Prof. Soderstrand in 1982 and used for several years.

Page 31: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

31

Brief History of Computer Software

Decimal Binary Octal Binary HEX 0 000 0 0000 0 1 001 1 0001 1 2 010 2 0010 2 3 011 3 0011 3 4 100 4 0100 4 5 101 5 0101 5 6 110 6 0110 6 7 111 7 0111 7

Decimal Binary Octal Binary HEX 8 1 000 10 1000 8 9 1 001 11 1001 9

10 1 010 12 1010 A 11 1 011 13 1011 B 12 1 100 14 1100 C 13 1 101 15 1101 D 14 1 110 16 1110 E 15 1 111 17 1111 F

Before we look at machine language let’s review binary

Page 32: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

Conversion from Binary to Octal

•Group the binary number into groups of THREE binary digits working out from the binary point• 1011100111101• Becomes• 001 011 100 111 101

•Read off each three-bit group in Octal:• 1 3 4 7 5

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

32

Start at the binary pointAdded zeros

Page 33: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

Conversion from Binary to HEX

•Group the binary number into groups of FOUR binary digits working out from the binary point• 1011100111101• Becomes• 0001 0111 0011 1101

•Read off each three-bit group in HEX:• 1 7 3 D

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

33

Start at the binary pointAdded zeros

Page 34: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

Conversion from Binary to Decimal (through HEX)

•Group the binary number into groups of FOUR binary digits working out from the binary point• 1011100111101• Becomes• 0001 0111 0011 1101

•Read off each three-bit group in HEX:• 1 7 3 D

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

34

Start at the binary pointAdded zeros

DECIMAL = ((1 x 16 + 7) x 16 + 3) x 16 + 13 = 5,94923 371368 5,936

Page 35: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

Brief History of Computer Software

• Let’s now return to our brief history of computer software

• The PDP-8 was an early microprocessor that had a simple yet powerful instruction set

•A quick look at this instruction set will reveal a great deal about machine language

• The PDP-8 uses 12-bit instructions expressed in Octal

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

35

Page 36: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

36

Brief History of Computer Software

Machine Language (Binary)

Assembly Language

Page 37: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

37

Brief History of Computer Software

Only Eight Instructions: AND, ADD, INCREMENT, DEPOSIT, JUMP to Subroutine, JUMP, I/O and Logical Operations

Page 38: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

38

Brief History of Computer Software

110 000 100 100I/O

Output to Printer

From the AC

Page 39: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

39

Brief History of Computer Software

111 100 010 000111 000 001 010

Page 40: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

This Completes our Brief History of Computers

• For COSC 236 (CS-1) we will be following the text very closely• Read the text BEFORE class

• My lecture will be keyed to the text

• READING ASSIGNMENT FOR WEDNESDAY• Read the text preface (pp. v through xiii)

• Look at the Table of Contents to see what the text covers (remember we cover 1-8, 12 and 13 only.

• Read the first two sections of Chapter 1 (pp. 1-23)

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

40

Page 41: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

Laboratory Homework – Due Tue 9/9 @ Midnight

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

41

NOTE: This is TWO apostrophe’s, not a quote

USE: System.out.println(“………..”);

Page 42: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

Laboratory Homework – Due Tue 9/9 @ Midnight

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

42

HINT: 1. Write a method, print10, that prints the sentence ten times2. Write a second method, print100, that calls print10 TEN times3. In the main program call print100, TEN times

This would print the sentence 1000 times – but it is not the most efficient!

Page 43: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

Laboratory Homework – Due Tue 9/9 @ Midnight

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

43

HINT:1. Write methods printM, printI, printS and printP to print each of

the letters2. From the main program, call the letter printing methods in the

correct order to spell out MISSISSIPPI3. NOTE: This will print the letters out VERTICALLY

Page 44: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

Laboratory Homework – Due Tue 9/9 @ Midnight

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

44

Page 45: COSC 236 Section 101 Fall 2014lecture-notes.tripod.com/handouts/COSC236Lecture01.pdf · Lecture 01 1/27/2014 2. Graded Assignments for COSC 236 ... a direct derivative of C++ and

Lab Assignment• Use the DrJava environment to implement the “Hello World” Program:

• Once you have successfully compiled and run the “Hello World” program, demonstrate it to Prof. Soderstrand in order to get today’s Quiz

• Complete today’s quiz and hand it in before you leave.

COSC 236 :Prof. M.A. Soderstrand Lecture 01 1/27/2014

45

public class Hello {public static void main (String[] args) {

System.out.println("Hello, world!");}

}