Sie sind auf Seite 1von 5

CS 113 - Introduction to Computer Science I

Base Syllabus
January 2012

Faculty Coordinator:
Dr. Narain Gehani, Junilda Spirollari

Overview
This course is a comprehensive introduction to the Java programming language
teaching writing, testing and debugging of programs. The course has three major
parts. The first part teaches fundamental programming techniques that use
primitive data types, variables, assignments expressions and operators, control
statements, arrays and files I/O. The second part covers testing and debugging and
teaches students how to write programs that work reliably. The third part
introduces object-oriented programming. The course guides students to the
development of comprehensive Java applications.

Prerequisites

CS100 Roadmap to Computing or equivalent

Objective
The objective of this course is to teach students how to write, test and debug Java programs so as
to produce reliable applications that meet specified problem requirements.

Material that Must Be Covered During the Semester

Introduction to programming and Java programming language


Data and Expressions
Using Classes and Methods
Decisions and Loops
Arrays and File I/O
Objects-Oriented Programming
a. Object-Oriented Design
b. Defining Classes and creating Objects
c. Defining methods
d. Inheritance
Testing and Debugging
Exceptions

Common Hour Exams


This course has two common hour exams. All sections take the same exam at the same time.
Students must attend these which are during common hour periods when no class is being taught.

Suggested Textbook(s)
Introduction to Java Programming 8/E, 2011 by Y. Daniel Liang, Publisher: Pearson, ISBN:
9780132130790

Evaluation
The evaluation will be based on the following course requirements:

Homework
Lab Assignments
Midterm Exams
Final Exam
Participation

Weekly Coverage of Material


The following table shows approximately how much time may be devoted to each topic and the
corresponding reading from the suggested textbook.
Week
(Approx)
1

Topic

Introduction to programming and Java


programming language

Reading from book


Ch. 1

Programming Languages
Compiled vs. interpreted languages
Getting Java and Eclipse
Compiling and running first program
Writing reliable programs
2

Data and Expressions

Primitive data
Declaration and use of variables
Expressions and operator precedence
Problem: Computing loan payments
Data conversion
Problem: Computing monetary units
String Class

Decisions and Loops

4
5

Ch. 2

Ch. 3, 4

Boolean expressions
Conditional statements (if, if-else, nested if, switch)
Problem: Guessing Birthdays
Problem: Computing Taxes
Problem: Lottery
Loops (while, do-while)
Iterators

Interactive programs
Writing interactive programs
The Scanner class

Ch. 9

Getting input from the user


The File class
File input and output
Problem: Computing exam score average
6

Review for Exam 1


Arrays

Single-dimensional arrays
Problem: Deck of Cards
Multidimensional arrays
Problem: Grading a multiple-choice test

Methods

Defining and invoking a method


Void methods
Return statement
Parameter passing
Problem: Converting Decimals to Hexadecimals
Overloaded methods
The Math Class

Objects and Classes

10

11
11

12

13

Ch. 6, 7

Ch. 5

Ch. 8

Object Oriented Design


Class Definition
Constructors
Constructing objects using constructors
Accessing objects via reference variables
Encapsulation and java modifiers
Passing objects to methods
Arrays of objects

Review for Exam 2


Testing and Debugging
Intro to correctness and robustness
Writing correct programs
Testing
Introduction to debugger concept
Run-time and logical errors
Step Commands - Step Over, Step Into and Step Return
Breakpoint and resume command
Other Eclipse debugging commands

Inheritance

Supplementary
material as provided
by instructor

Ch. 11

Deriving new classes from existing ones


Superclasses and Subclasses
Using the super keyword
Protected modifier
Creating class hierarchies
Overriding Methods
The Object Class
Indirect visibility of inherited members
14

Exception Handling
Exception Handling overview

Ch. 13

When to use exceptions


Exception types
Try-catch statement
The finally clause
Exception classes
I/O exceptions

Typical Assignments: Lab and Homework


Lab Assignments (to be done in class)
1. Health application. BMI (Body Mass Index) is a measure of health on weight. It can be
calculated by taking your weight in kilograms and dividing by the square of your height
in meters. Write a program that, given a weight in pounds and height in inches, will
display the BMI.
Note that one pound is 0.45359237 kilograms and one inch is 0.0254 meters.
2. Game: scissor, rock, paper. Write a program that plays the popular scissor-rock-paper
game. A scissor can cut a paper, a rock can knock a scissor, and a paper can wrap a rock.
The program randomly generates a number 0, 1, or 2 representing a scissor, rock, and
paper and prompts the user to enter number 0, 1 or 2 and displays a message indicating
whether the user of the computer wins, looses or draws.
3. Reading from files. Write a program that asks the user to read from the keyboard the
name of a file containing exam scores. The program reads exam scores from the file and
displays on the screen their total and average. Scores are separated by blanks.
Homework Assignments
1. Finding the factors of an integer. Write a program that asks the user to read in from the
keyboard an integer. The program displays all its smallest factors in increasing order. For
example, if the input integer is 120, the output should be as follows: 2, 2, 2, 3, 5.
2. Defining a class (the Stock class). As defined in Wikipedia, the capital stock (or
just stock) of a business entity represents the original capital paid into or invested in the
business by its founders. Design a class named Stock that contains:
a. A string data field named symbol for the stocks symbol.
b. A string data field named name for the stocks name.
c. A double data field named previousClosingPrice that stores the stock price for the
previous day.
d. A double data field named currentPrice that stores the stock price for the current
time.
e. A constructor that creates a stock with specified symbol and name.
f. A method named getChangePercent () that returns the percentage changed from
previousClosingPrice to currentPrice.
Draw the UML diagram for the class. Implement the class. Write a test program that

creates a Stock object with the stock symbol JAVA, and the previous closing price of 4.5.
Set a new current price to 4.35 and display the price-change percentage.

Das könnte Ihnen auch gefallen