• No results found

CS 170 Java Programming 1. Welcome to CS 170. All about CS 170 The CS 170 Online Materials Java Mechanics: Your First Program

N/A
N/A
Protected

Academic year: 2021

Share "CS 170 Java Programming 1. Welcome to CS 170. All about CS 170 The CS 170 Online Materials Java Mechanics: Your First Program"

Copied!
42
0
0

Loading.... (view fulltext now)

Full text

(1)

CS 170

Java Programming 1

Welcome to CS 170

All about CS 170

The CS 170 Online Materials Java Mechanics: Your First Program

(2)

What’s the Plan?

 Topic I: What’s CS 170 All About?

 Contact information

 Topics, Goals and Objectives  Exams and Assignments

 Textbook and software  Rules for the course

 Topic 2: the online classroom, lessons and assignments  Topic 3: Java Mechanics

 Learn to use the DrJava Development Environment  Enter, modify and run three kinds of Java programs

(3)

Contact Information

 The syllabus is always available from my Web site:

http://faculty.orangecoastcollege.edu/sgilbert

 Here’s how you can contact me:

 Clark Computing Center, Office F

 Office hours: M: 1:15-2:15, T: 3:15-5:15 , W: 10-11

 Email: [email protected], [email protected]  Phone: (714) 432-0202 ext 21173

(4)

What’s CS 170 About?

 First programming class for Computer Science majors

 Intended as a transfer class to 4-year college

 SMART-ICS agreement with UCI, CSU Fullerton

 Meets computing requirement at some universities

 Principles of programming, using Java as the language

 Learn to write your own computer programs  This semester we'll also be processing media  A lot of work, but a lot of fun if you get into it

(5)

Are You Ready?

 While there are no subject prerequisites for this course,

I assume that you are computer literate

 Install and run programs

 “Move around” your computer’s file system (copy, delete)  Use a zip/unzip program to work with archives

 Create and save plain text files

 Use the Web and email (upload, download, etc.)

(6)

Course Goals

 If you successfully complete this class you'll:

 Understand and explain principles of OO Programming

 Prepare you for other modern languages

 Use different kinds of program development tools

 Write applications and applets using the fundamental

packages in the Java platform

 Won't study all the classes; try to master a few

 Learn how to use the Java documentation so it can teach

(7)

How Can You Succeed in CS 170?

 Don't need to be a "brain" but must put in quality time

 Like a marathon or getting in shape

 Anyone can do it, but you have to keep at it

 2.5 hours on-campus and about 12 hours outside

 Includes 2.5 hours online lessons, 8 hours practice

 Cramming won't help you at all; highly sequential material  Practice, practice, practice

(8)

How Will You Be Graded in CS 170?

 2 Exams: 1 midterm (15%.), 1 final (25%)

 Multiple-choice: 1-2 hrs closed book, online

 10 Reading Quizzes: (7.5%) – online, open book

 10 Programming Quizzes: (35%) – in-class, closed book

 Hands-on proficiency demonstrations, some re-do

 Weekly "labs" or "In-Class" exercises (7%)

 Weekly Homework: practice for exams (15%)

 1045 points, grade on 1000 (45 extra for emergencies)

(9)

Textbook

 Introduction to Java Programming

 Custom textbook for CS 170

 Tony Gaddis-ISBN: 9780558618063  Available in the OCC bookstore ($75)

 Includes 7 chapters from the 4th edition Starting Out With Java:

From Control Structures through Objects

ISBN: 978-0136080206.

(10)

Software and Supplies

 Software is all free and cross-platform

 At home, you can use Windows, Unix/Linux, Mac OS X  Use Java version 6 (may use 5 on older Macs (10.4))  An OCC-customized version of DrJava IDE

 Can put everything on a USB thumb drive

 Then you can work on almost any computer

(11)

Rules for the Course

 May take Pass/Fail; request deadline on your schedule  No late work accepted

 Assignments normally due by noon on Monday

 45 points possible extra credit to cover "emergencies"  Don't wait until the last minute

 Retry/makeup only for programming proficiency quizzes

 May re-try up to 4 of the 10 PPQ exams

 Pay attention to OCC drop deadlines: no Incompletes  Do your own work, and act like adults

(12)

Topic 2

The CS 170 Online Classroom

Getting Into the Classroom Getting Around the Classroom

Submitting Assignments and Taking Quizzes Reading the Online Lessons

(13)

Passwords and Logging In

 You'll have two passwords for this class

 A OCC Computing-Center password for the LAN

 See the help-desk in the Computing Center for info

 A MyOCC password to get into your email, etc.

(14)

Direct Log-on

 Can log onto Blackboard directly (no MyOCC)

 Still use your MyOCC password and ID

https://cccd.blackboard.com

 Probably want to bookmark this

 Half of your "class-time" will consist of online "lectures"

(15)

Blackboard Tutorials

 You'll need to read the online tutorials to learn how to use

(16)

CS 170 Classroom

(17)

Quizzes

 You'll take the reading quizzes online, outside of class

(18)

Assignments

 Use the Assignment Drop-box to turn in IC assignments

(19)

Your "IC" or "Lab" Document

 Will submit an "in-class" lab document each week.  Use Word or OpenOffice to create a new document

 Save the file as IC01.doc (Office 97-2003 compatible)  Place on your network U: drive or on a thumb drive  Put your name and today's date at the top of the sheet  Title it "CS 170 In-class Exercise 1"

 Save and close, upload to Blackboard and submit.  Exercise 1.1: show me your assignment submitted  Retrieve and discard uploaded file when done.

(20)

Weekly Lessons

(21)

Homework Assignments

 Exercise page at bottom of weekly start page

 Directions, points, submission instructions  Start working on Homework 01 now

(22)

Topic 3

Hands-On: Java Mechanics

How are Java programs created? What steps do you follow?

(23)

Step 1: Write the Code

 Use a text editor to write your programming instructions in the Java language

 Notepad, SciTE, vi, TextWrangler or an IDE

 We'll use DrJava

 Called source code  Save in a file with

(24)

Step 2: Compile the Code

 Use a Java compiler to translate your source code into

executable machine code

 javac in the JDK

 Called bytecode  Stored in a file with

the extension .class  If syntax errors occur,

(25)

Step 3: Run your Program

 Use a Java Virtual Machine (JVM) to load the bytecode,

translate into native machine code and start it running

 Applications: java.exe

or javaw.exe

 Applets: HTML

 Web browser, appletviewer

 If runtime errors occur,

(26)

Your First Java Program

 We'll first write an application using the DrJava IDE

 Exercise: copy the cs170home-F10 folder from Q: and

place (drop) it on your U:\ (network) or USB Thumb drive

(27)

Starting DrJava

 Exercise: start the DrJava IDE by opening the tools

(28)

Logging In

 Type your last name and student ID to start DrJava.

 Student ID must start with C

 Skip any spaces in your last name  If you aren't registered or are

not connected to the Internet, then select Guest Access

 Logging-in is needed to record the score for your homework assignments

(29)
(30)

Preview: Java Syntax

 Every Java program is a class definition

 Class definition is a blueprint to construct objects  The basic class structure looks like this:

… some stuff

public class SomeClassName {

… some more stuff }

 Must be stored in SomeClassName.java  Only one public class per file

(31)

Step 1: Edit the Source Code

 Find source code for program at:

 Q:\faculty5\sgilbert\cs170\edit-program01.gif  Right-click, "Preview"  Type in code, replacing noted portions

 Save the file

when done

Exercise 1.2

(32)

Step 2: Compiling Your Program

 Several ways to compile your code when saved

 Right-click to compile a single file

(33)

When Bad Things Happen

 Common Syntax

or Compiler Errors

 Syntax must be 100% correct for a program to run  Capitalization: (System not system, String not string)  Spelling the name of your source file incorrectly

 Forgetting or mismatching the number of braces  Mistaking parentheses for braces

 Misspelling the name of a variable

 Edit and then recompile until there are no errors

Exercise 1.3

(34)

Step 3: Running Your Program

 You can use the menu command Tools->Run Document,

(35)

Viewing the Output

 Program is run in DrJava's Interactions Pane  Can view just output in Console Pane

Exercise 1.4

(36)

Testing Your Code

 Program may not do what you want (logic error)  Test by comparing actual and expected output

 I'll supply tests for first few weeks. Later you'll learn how to write your own test programs.

(37)

Testing Your Code

 Check program looks for existing test sets.

(38)

Test Results

 Results appear in Interactions and Console panes

Exercise 1.5

(39)

Check your Style

 Portion of your grade based on program style

(40)

Fix Style Errors

 Checkstyle shows errors in external process pane:

 Correct all style errors by checking line number

Exercise 1.6

(41)

GUI App and Java Applet

 To complete your IC "lab" document:

 Compile and run a Java GUI application  Compile and run a Java applet

 Shoot screen-shots  Submit to Blackboard

 Instructions are in online lesson on Blackboard

(42)

Finishing Up

 Reading for next week:

 Mediacomp: read Chapter 1 and start Chapter 2  Gaddis: start Chapter 1

 Homework, Quiz and Assignments

 Deadline is Tuesday at noon because of Labor Day  Introduce yourself on discussion board

 Three homework problems

References

Related documents

Book to bill increased to 113% in cyclical activities (Systems Integration and Consulting & Technology Services), mainly led by Germany, Benelux & The Nordics

LTC and ancillary timecode (referred to as VITC on HDCam SR VTRs) must be identical, contiguous and continuous throughout the recording. It is recommended that assemble edits

V svojem magistrskem delu želim torej ugotoviti, kako razvite spretnosti timskega dela imajo strokovni delavci v vrtcu vzgojiteljice in pomočnice vzgojiteljice ter s kakšnim vedenjem

Posterior Instrumentation, Aspen™ Spinous Process System Versus Pedicle Screw Fixation, in Lateral Lumbar Interbody Fusion (LLIF) or Anterior Lumbar Interbody Fusion (ALIF). 144

This is a system of classes and objects that employ special machinery for detectings errors and shifting responsibilites for handling these problems. Java recognized two kinds

A history of childhood attention-deficit hyperactivity disorder (ADHD) impacts clinical outcome in adult bipolar patients regardless of current

Multi-tier ● Single-tier – No separation among presentation, business logic, database – Hard to maintain ● Multi-tier – Separation among presentation, business logic,

Java Program (MyProgram.java) Java Compiler (javac) Java Bytecode (MyProgram.class) HW-based Platform (Sun + Solaris OS) Java API. Interpreter or