Welcome to Professor Ziegler's CISC 1115 Sample Program Home Page




The following are links to files containing source code foir the sample programs used during the in-class lectures. You may download a copy of these notes only if you are a registered student in my CISC 1115 class. To download a file, RIGHT CLICK on the link and use the "Save Link Target As" feature of your browser.

Topic 1:

My Hello World

Introductory Program - Welcome

Program to illustrate keyboard input and monitor output

Program to illustrate addition

Introductory Sample Program

Program to illustrate iteration

Program to illustrate use of for loops


Topic 2:

Writing an Expression

Using Table Headings

Formatted Output

Specifying Precision

Using Tabs

Specifying Width

Illustrating Left Justification

Illustrating Centered Output

Redirecting Output to a File

Redirecting Output to a File - illustratimg Separate Object Instantiation


Topic 3:

Payroll program

Payroll program using Dialog Boxes

Illustrating use of an if-else statement

Payroll program with redirection of output to a file

Payroll program with separate input and output file objects

Payroll program with tabular output

Sample input data file for Topic 3 programs


Topic 4:

Sum of Squares example

Loop Control Variables

Defining a Constant

Reading in a value for loop termination control

Multiplication Table - Nested for loops


Topic 5:

Program with a Value Return Method

Method with Multiple Parameters and a Local Variable

Method with Multiple Return Statements

Sample Program with a Method

Multiplication Table using Methods

Pass by Value Example

Pass by Value with Return Example

Pass by Object Reference Example

Multiplication Table using Methods with File I/O

Returning a value of type boolean


Topic 6:

Classify program

Nested if-else statements

Shortcut - Direct calculation of which week

Variables of type boolean

Generate Random Numbers


Topic 7:

Calculating the Average of an Exam

Using Arrays

Calculating the Average of an Exam - more modular version

Passing an array to a Method

Exam Statistics

Exam Statistics - Detecting EOF()

Array Identifiers

Two Dimensional Arrays

Two Dimensional Arrays - modular

Sample input data file for Topic 7 programs

Sample input data file for Two Dimesional Array program

Sample input data file for second Two Dimesional Array program


Topic 8:

Illustrating String .indexOf() Method

Illustrating .replace(), .delete(), and .insert() Methods

Passing a String to a Method

Passing a String to a Method - Illustrating StringBuilder Class

Less modular version - Method change() using .replace()

Less modular version - using StringBuilder Class

Less modular version - using String Method replaceAll()

Array of Strings

Passing an array of strings to a Method

Illustrating a String Tokenizer using method .split()

Illustrating "is" Methods

Less modular version - pass String array - using String Method replaceAll()

More on Comparing Strings

Sample input data file for Topic 8 programs

Sample "changes" input data file for Topic 8 programs


Topic 9:

Selection Sort

Selection Sort - Alternate Algorithm

Bubble Sort

Sorting Strings

Sorting Strings in a Method

Binary Search


Topic 10:

Simple Classes - Public Data Members
     Name Class      JobInfo Class      PersonalInfo Class      Contestant Class

Simple Classes - Private Data Members with Setters and Getters and a StringTokenizer Object
     NamePrv Class      JobInfoPrv Class      PersonalInfoPrv Class      ContestantPrv Class

Simple Classes - Private Data Members using a StringTokenizer Object - Modified ReadData()

All Class Private Data Members using String Method .split()

All Class Public Data Members using String Method .split()

All Class Private Data Members using String Method .next()

Sample input data file for Topic 10 programs


Comments or suggestions should be sent to:

ziegler@sci.brooklyn.cuny.edu

Chaim Ziegler, Ph.D.
Brooklyn College
Department of Computer and Information Science
2900 Bedford Avenue
Brooklyn, NY 11210
(718) 951-5000 x2074