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 illustarte 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 Constatnt

Reading in a value for loop termination control

Multiplication Table - Nested for loops


Topic 5:

Simple 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


Topic 6:

Classify program

Nested if-else statements

Shortcut - Direct calculation of which week

Variables of type boolean

Returning a value of type boolean


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()

Two Dimensional Arrays

Sample input data file for Topic 7 programs

Sample input data file for 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

Array of Strings

Passing an array of strings to a method

Illustrating a String Tokenizer using method .split()

Sample input data file for Topic 8 programs

Sample "changes" input data file for Topic 8 programs


Topic 9:

Linear Sort

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
     NamePrv Class      JobInfoPrv Class      PersonalInfoPrv Class      ContestantPrv Class

All Class Private Tokens

All Class Public Tokens

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