Tutorial01 - In-Lab 1 Computer Programs(Exercise...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: In-Lab 1: Computer Programs (Exercise) Introduction:This exercise has two parts. In Part 1, you will experiment with instructions using DrJava’s special “Interaction” mode. These short examples are not programs themselves. They allow you to try things out before creating a real program. You will also be introduced to some important vocabulary terms covered in section 1.10 of the textbook. In Part 2, you will enter an actual program, similar to what you will do for Lab #1. Part 1:1. Start DrJava (the icon is a large “J” with a stethoscope). You should see the following screen: 2. Click next to the “>” prompt in the Interactionswindow near the bottom (located inside the dashed oval in the figure above). You should now have a blinking cursor there. 3. Java can calculate mathematical expressions. Type the following expression, and press the ENTER key where shown: 2+2<ENTER>You should see the result 4on the screen. 4. Java performs algebraic operations in the standard order (e.g. multiplication and division before addition and subtraction). Type the following expression, and press the ENTER key where shown: 1+2*3-4/2<ENTER>You should see the result 5on the screen. 5. In programming, a variableis similar to a variable in mathematics. Each one has a unique name and may be set to different values. Type the following instructions, and press the ENTER key where shown: a = 1;<ENTER>b = 2;<ENTER>c = 3;<ENTER>You will begin typing here. a+b*c...
View Full Document

This note was uploaded on 04/10/2008 for the course ENGR 131 taught by Professor Xiaowei during the Spring '07 term at Case Western.

Page1 / 4

Tutorial01 - In-Lab 1 Computer Programs(Exercise...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online