{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

65-lecture03 - Computer Science 65 Intro to CS January 31st...

Info iconThis preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon
Computer Science 65 Intro to CS January 31st, 2008 Psuedocode Java Syntax
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Announcements Assignment #2 Paper and Pencil Assignment Out today, posted on blackboard Due Thursday, February 7th
Background image of page 2
Intro to Programming Two types of programming Procedures: set of programming statements that perform a specific task Procedures operate on data items that are separate from the procedures What happens if data format is altered?
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Quick Intro Object Oriented Programming Object Oriented Programming (OOP) is centered on creating Objects Advantages of OOP: Combining data and code Object’s ability to hide data from code outside the object
Background image of page 4
Object Example Rectangle Attributes? (data) Methods? (procedures)
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Algorithms & Psuedocode Computer Science is the study of algorithms Computers are programmable machines that can be used to implement algorithms Computers help us solve problems Programming languages have strict rules, known as syntax , that must be carefully followed Psuedocode:
Background image of page 6
What’s Wrong with the following psuedocode? ***calculate the ratio a/b*** Display “Input the value of a” Input a Display “Input the value of b” Input b Display “the ratio is” Display ratio
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Psuedocode Predict the Result variable x starts with 7 variable y starts with 2 add 1 to x add 3 to y subtract y from x, store the result in x print x print y
Background image of page 8
How To Program 1. Think about the problem 2. Write down the algorithm on paper Psuedocode: informal high-level description of an algorithm Step1: Step2: … 3. Translate psuedocode to java and enter the code in Eclipse 4. Fix errors 5. Test code to make sure it works for all expected input
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Java Fundamentals Java programs are made up of several elements words that have special meaning examples: public, int, float, main Key Words are also known as _________________
Background image of page 10
Java Reserved Keywords abstract assert boolean break byte case catch char class const continue default do double else enum extends false for final finally float goto if implements import instanceof int interface long native new null package private protected public return short static strictfp super switch
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 12
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}