Programming in Java I or Introduction to Computer Science

Course Objectives:
· Understand the basic elements of computer hardware and software and their roles in a computer system; understand the Internet
· Get familiar with Java syntax and good programming style; learn to pay attention to code clarity and documentation
· Learn the basics of Java syntax for declaring classes and methods, constants and variables, arithmetic expressions
· Understand the concept of an algorithm; implement simple algorithms in Java using if-else statements and simple loops
· Get an introduction to the key OOP concepts: classes and objects, inheritance and eventdriven computations
· Acquire some skills in designing software solutions to problems from various application areas

Texts and Supplementary Materials:
Litvin, Maria, and Gary Litvin. Java Methods: An Introduction to Object-Oriented Programming. Andover, Mass.: Skylight Publishing, 2001.
Ancillary materials: Java Methods Student Disk, PowerPoint slides.

Course Outline:
Chapter numbers for readings and exercises refer to Java Methods. The labs, case studies, and projects proposed below come from Java Methods .

1. Introduction to hardware and software (Week 1; duration 1 week)
Elements of a computer system. How information is represented in computer memory. A glimpse of binary and hex systems and ASCII/Unicode.
Reading and exercises: Chapter 1.
Lab: Find and explore the home pages of some Internet and World Wide Web pioneers.

2. Software development environment (Week 2; duration 1 week)
An introduction to algorithms. Getting familiar with the software development process. Compilers and interpreters. Java SDK tools (javac, java, appletviewer, javadoc). Using a command-line environment and an IDE. Java classes and source files. The EasyReader class. A brief introduction to OOP.
Reading and exercises: Chapter 3.
Lab: Compile and run simple programs using command-line SDK tools or an IDE (Section 3.5).
Lab: Compile and run simple GUI applications and applets (Section 3.7).

3. A first look at objects and events (Weeks 3-4; duration 2 weeks)
Classes and objects. Classes and source files. Case study: Ramblecs Applet (a prototype for a game). Objects and classes in Ramblecs. Library classes and packages. The import statement. Extending library classes. A first look at fields, constructors, and methods. A brief introduction to events handling in Java.
Reading and exercises: Chapter 4.
Lab: Exploring objects: add a second panel with a falling cube to Ramblecs (Exercise 4-9).
Lab: Exploring events: the Morning applet (Exercise 4-11).
Syllabus: Programming in Java I or Introduction to Computer Science 3

4. Java syntax and style (Week 5; duration 1 week)
Syntax and style in a programming language. Comments. Reserved words and programmerdefined names. Statements, braces, blocks, indentation. Syntax errors, run-time errors, logic errors.
Reading and exercises: Chapter 5; Appendix B.
Lab: Correcting syntax errors and a logic error as an “adventure game” (Section 5.6).

5. Data types, variables, and arithmetic (Weeks 6-7; duration 2 weeks)
The concepts of a variable and a data type. Declarations of variables. Fields vs. local variables. The primitive data types: int, double and char. Literal and symbolic constants. Initialization of variables. Scope of variables. Arithmetic expressions. Data types in arithmetic expressions. The cast operator. The compound assignment (+=, etc.) and increment and decrement operators
(++, --).
Reading and exercises: Chapter 6.
Lab: Pie Chart (Section 6.9).
Lab: Rainbow (Self-Test 1).

6. The if-else statement (Weeks 8-10; duration 3 weeks)
The if-else statement, Boolean expressions, the boolean data type, true and false values. Relational and logical operators. De Morgan’s laws. Short-circuit evaluation. Nested if-else and if-else-if. Case Study: Craps. Elements of OO Design in Craps. The switch statement.
Reading and exercises: Chapter 7.
Lab: From exercises for Chapter 7.
Lab: The CrapsGame class for Craps: fill in the blanks and test in isolation (Section 7.10).
Lab: Finishing and testing the Craps applet (Section 7.12).

7. Classes, constructors, methods, and fields (Weeks 11-13; duration 3 weeks)
Defining methods. Overloaded methods. Constructors. Creating objects with the new operator.
Static fields and methods. Calling methods and accessing fields. Passing arguments to methods and constructors. The return statement. Public and private fields and methods. Encapsulation and information hiding. Case study: The Fraction Class. Case study: Snack Bar.
Reading and exercises: Chapter 8.
Lab: From exercises for Chapter 8.
Lab: Finishing the Fraction class (Section 8.11).
Lab: Implementing the Vendor class for Snack Bar (Section 8.12).