{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Class 15 - From Alice to Java 1 Goals for Today n n n Write...

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

View Full Document Right Arrow Icon
From Alice to Java 1
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
Goals for Today n Write some first Java programs n Learn the basics of the Eclipse Integrated Development Environment (IDE) n Begin making the transition from Alice to Java 2
Background image of page 2
From Alice to Java n The four steps of computer programming ¨ 1. Designing the program ¨ 2. Writing the program ¨ 3. Running the program ¨ 4. Testing the program n Program development using Alice ¨ Step 1: Write user stories and construct storyboards ¨ Step 2: Add objects to world, animate with messages ¨ Step 3: Press the Play button ¨ Step 4: Scrutinize a number of executions 3
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
From Alice to Java (continued) n Benefits of program development using Alice ¨ 3D graphics let you visualize programming concepts ¨ Drag-and-drop coding reduces syntax errors n Benefits of program development using Java ¨ Build reusable classes ¨ Run Java programs across various platforms ¨ Build applets to make Web pages interactive 4
Background image of page 4
Designing a First Java Program n Use many techniques learned in Alice n First step: write a user story to help setup structure n User story for dollars-to-euros currency conversion ¨ Query user for dollar amount to convert to euros ¨ Read the dollar amount from the user ¨ Query user for euros-per-dollar exchange rate ¨ Read euros-per-dollar exchange rate ¨ Compute corresponding number of euros ¨ Display dollar and (computed euros values) 5
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
The Object List n Review: class is blueprint for an object n Procedure for isolating objects in the user story ¨ Identify the noun phrases (primary object indicators) ¨ Create a table listing nouns, values stored, and names n The name should also be a noun (or noun phrase) n The name should be descriptive ¨ If no Java type matches the value, define a class n Naming convention ¨ Class: capitalize each word in the name ¨ Variable or method: capitalize each word except first 6
Background image of page 6
The Object List (continued) 7
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
The Operations List n Operations correspond to verb phrases in user story n Procedure for isolating verbs in the user story ¨ Identify the verb phrases (primary operation indicators) ¨ Create a table listing verbs and matching operations n There are five verb phrases in the user story 8
Background image of page 8
The Operations List (continued) 9
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
The Algorithm n Algorithm: sequence of steps that solve a problem n Algorithm for converting dollars to euros ¨ 1. Display "How many dollars do you want to convert?" ¨ 2. Read dollars ¨ 3. Display "What is the euros-per-dollar exchange
Background image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}