CS 180 Recitation - PowerPoint PPT Presentation

1 / 15
About This Presentation
Title:

CS 180 Recitation

Description:

Java: an Introduction to Computer Science & Programming - Walter Savitch. 2 ... Java programs intended to be installed then run. often larger applications ... – PowerPoint PPT presentation

Number of Views:30
Avg rating:3.0/5.0
Slides: 16
Provided by: lewra7
Category:

less

Transcript and Presenter's Notes

Title: CS 180 Recitation


1
CS 180 Recitation
2
Reminders Information
  • No Lecture Monday (MLK Holiday)
  • Labs/recitations as normal next week
  • Class website http//web.ics.purdue.edu/cs180/S
    pring2006Web/
  • Class Newsgroup
  • purdue.class.cs180
  • Follow the newsgroup for project information and
    questions newsgroup postings from GTAs are
    official. Even if you dont follow the newsgroup
    you are responsible for all updates/changes to
    any projects mentioned there.

3
Reminders Information
  • Discussion Groups
  • Facilitated by Barry Wittman
  • Once or twice a week (TBD) discussion of CS180
    related material
  • Extra credit 1/3 point (max of 5 total for the
    semester) for each session attended
  • First session Monday, January 23 (tentative),
    time/location TBD
  • Look for more information in lecture recitation
    next week and on the class newsgroup

4
Computer Basics
  • Computer system hardware software
  • Hardware the physical components
  • Software the instructions that tell the hardware
    what to do

5
File System
6
Binary Versus Text Files
  • All data and programs are ultimately just zeros
    and ones
  • each digit can have one of two values, hence
    binary
  • bit is one binary digit
  • byte is a group of eight bits
  • Representing Numbers the bits represent a number
    (each individual bit is a power of 2)
  • 13 1101b 1x23 1x22 0x21 1x20
  • 49 00110001b
  • 180 10110100b
  • Representing Text the bits represent printable
    characters
  • one byte per character for ASCII, the most common
    code
  • For example 65 01000001b A

7
Testing and Debugging
  • Even with careful programming, your code could
    still contain errors and must be thoroughly
    tested.
  • Buga mistake in a program
  • Debuggingfinding mistakes in a program and
    (possibly) fixing them

8
Types of Errors
  • Syntax
  • Run-Time
  • Logic

9
Syntax
  • The set of grammar rules for a programming
    language is called the syntax.
  • The compiler checks your program to make sure it
    is a valid Java program.
  • If your program is not a valid Java program, then
    the compiler outputs a message indicating a
    syntax error.

10
Syntax Errors
  • caught by compiler (compiler-time error)
  • automatically found, usually the easiest to fix
  • cannot run code until all syntax errors are fixed
  • error message may be misleading
  • Example
  • Misspelling a command, for example rturn
    instead of return

11
Run-Time Errors
  • An execution error (during run-time)
  • Not always so easy to fix
  • Error message may or may not be helpful
  • Not detected by the compiler.
  • Example
  • Division by zero - if your program attempts to
    divide by zero it automatically terminates and
    prints an error message.

12
Logic Errors
  • Just because it compiles and runs without getting
    an error message does not mean the code is
    correct!
  • An error in the design (the algorithm) or its
    implementation
  • code compiles without errors
  • no run-time error messages
  • but incorrect action or data occurs during
    execution
  • Generally the most difficult to find and fix
  • Need to be alert and test thoroughly
  • think about test cases and predict results before
    executing the code

13
Logic Error Examples
  • Algorithm Error
  • averageOfFiveScores SumOfScores/2(should
    divide by 5)
  • Implementation Error
  • typed in wrong symbol in source code -sum a -
    b(should be sum a b)

14
Applets vs. Java Applications
  • Applets
  • Java programs intended to be downloaded via the
    Web and run immediately
  • little applications
  • requires a web browser
  • Applications
  • Java programs intended to be installed then run
  • often larger applications
  • Slightly different programming for each, but both
    are easy to do
  • Applet example http//www.willamette.edu/gorr/cl
    asses/cs130/lectures/BinaryConversion/convert.html

15
Operating System
  • A computer program that controls the components
    of a computer system and facilitates the
    operation of applications
  • Examples
  • Windows
  • MacOS
  • Unix
  • Linux
  • Solaris
Write a Comment
User Comments (0)
About PowerShow.com