CS 112 Lecture Notes

Lecture notes will be made available shortly after each lecture. Some of the examples used are taken from the two textbooks used for this course.

  • Lecture 1 (Sep 1) Introduction  (6/page PDF, 2/page PDF, Powerpoint)

  • Lecture 2 (Sep 3) C# Program Structure; Our First C# Programs  (6/page PDF, 2/page PDF, Powerpoint)
  • C# compiler under Command Prompt:
  • copy and edit the file using SciTE or notepad.
  • type csc FileName.cs to compile
  • type FileName to run
  • HelloWorld.cs
  • HelloWorldWin.cs
  • Humor
  • Lecture 3 (Sep 6) CS112 Computing Environment

  • Lecture 4 (Sep 8) C# Variables, Data Types, and IO  (6/page PDF, 2/page PDF, Powerpoint)
  • Data powers of ten
  • C# Type Table
  • TestNumeric.cs
  • TaxAndTotal.cs
  • C# Format Specifiers
  • Lecture 5 (Sep 10) The TAs' Guide to CS112 Setup
  • Windows and Command Prompt  (2/page PDF and Powerpoint)
  • Visual C# programming environment.
  • Programming style  (2/page PDF and Powerpoint)
  • Lecture 6 (Sep 13) Arithmetic and Assignment Operations  (6/page PDF, 2/page PDF, Powerpoint)
  • C# Format Specifiers
  • Arithmetic.cs
  • TemperatureConverter.cs
  • DataConversion.cs
  • Increment.cs
  • C# conversion (in particular the implicit numeric conversions)
  • Lecture 7 (Sep 15) Conditional Statements and Boolean Operations  (6/page PDF, 2/page PDF, Powerpoint)
  • Increment.cs
  • C# conversion (in particular the implicit numeric conversions)
  • C# operator precedence
  • Comparison.cs
  • BooleanOrder.cs
  • LogicalOperators.cs
  • LogicalVsConditional.cs
  • Lecture 8 (Sep 17) Simple Control Structures  (6/page PDF, 2/page PDF, Powerpoint)
  • Wage.cs
  • IfElseMatch.cs
  • Forever.cs
  • WhileCounter.cs
  • Average1.cs
  • Average2.cs
  • ReverseNumber.cs
  • Lecture 9 (Sep 20) More Control Structures  (6/page PDF, 2/page PDF, Powerpoint)
  • ReverseNumber.cs
  • Analysis.cs
  • ForCounter.cs
  • BreakTester.cs
  • ContinueTester.cs
  • SwitchTester.cs
  • Lecture 10 (Sep 22) More Control Structures (see Lecture 9)

  • Lecture 11 (Sep 24) Loop Examples  (6/page PDF, 2/page PDF, Powerpoint)
  • GamePlay.cs
  • IntLargest.cs
  • IntSnd.cs
  • Triangle.cs
  • Lecture 12 (Sep 27) Methods, Classes, and Objects  (6/page PDF, 2/page PDF, Powerpoint)
  • C# Console class
  • C# MessageBox class
  • C# String class
  • C# Random class
  • SquareSm.cs
  • TestMethods.cs
  • Sum.cs
  • Interest.cs
  • RandomNumbers.cs
  • Lecture 13 (Sep 29) Method Overloading and Parameter Passing  (6/page PDF, 2/page PDF, Powerpoint)
  • MaximumValue.cs
  • RandomInt.cs
  • MethodOverload.cs
  • TestRef.cs
  • TestOut.cs
  • RefOutTest.cs
  • Lecture 14 (Oct 1) Variable Scope and Duration  (6/page PDF, 2/page PDF, Powerpoint)
  • RefOutTest.cs
  • Scope.cs
  • Calendar.cs
  • Lecture 15 (Oct 4) Decomposition  (6/page PDF, 2/page PDF, Powerpoint)
  • Calendar.cs
  • Lecture 16 (Oct 6) Debugging; Defining Classes  (6/page PDF, 2/page PDF, Powerpoint)
  • Time1.cs
  • TimeTest1.cs
  • Coin.cs
  • CountFlips.cs
  • FlipRace.cs
  • Lecture 17 (Oct 8) Encapsulation  (6/page PDF, 2/page PDF, Powerpoint)
  • C# Access Modifiers
  • Time2.cs
  • TimeTest2.cs
  • Time3.cs
  • TimeTest3.cs
  • RestrictedAccess.cs
  • Lecture 18 (Oct 11) Object Life Cycle and Destructor  (6/page PDF, 2/page PDF, Powerpoint)
  • TimeLifeCycle.cs
  • Time3.cs with finalizer
  • StaticTest.cs
  • UsingConstAndReadonly.cs
  • ThisTest.cs
  • Time4.cs
  • Lecture 19 (Oct 13) Midterm Review
  • List of Covered Topics
  • Sample First Exam Questions
  • Lecture 20 (Oct 18) Arrays  (6/page PDF, 2/page PDF, Powerpoint)
  • ArrayReferenceTest.cs
  • InitArray.cs
  • SumArray.cs
  • Histogram.cs
  • Calculator.cs
  • StringArray.cs
  • StudentPoll.cs
  • RollDie.cs
  • PassArray.cs
  • Lecture 21 (Oct 20) Strings and Characters  (6/page PDF, 2/page PDF, Powerpoint)
  • TwoDimensionalArrays.cs
  • DoubleArray.cs
  • C# String class
  • StringConstructor.cs
  • StringMethods.cs
  • SubString.cs
  • StringConcatenation.cs
  • StringCompare.cs
  • StringStartEnd.cs
  • StringIndexMethods.cs
  • StringMethods2.cs
  • StaticCharMethods.cs
  • C# StringBuilder class
  • Lecture 22 (Oct 22) Multi-Dimensional Arrays; Strings  (6/page PDF, 2/page PDF, Powerpoint)
  • TwoDimensionalArrays.cs
  • DoubleArray.cs
  • Lecture 23 (Oct 25) Characters; More on Classes and Objects  (6/page PDF, 2/page PDF, Powerpoint, also see Lecture 18)
  • C# Char class
  • Time4.cs
  • ThisTest.cs
  • Rational.cs
  • RantionalNumbers.cs
  • LineUp.cs
  • StickFigure.cs
  • Book.cs
  • Dictionary.cs
  • BookInheritance.cs
  • Lecture 24 (Oct 27) Window Applications; Graphics Programming  (6/page PDF, 2/page PDF, Powerpoint)
  • C# System.Drawing Namespace (Brush, Brushes, Color, Font, FontFamily, FontStyle, Graphics, Pen, Size, SolidBrush)
  • C# System.Windows.Forms Namespace
  • HelloWorld.cs
  • LinesRectanglesOvals.cs
  • ColorChips.cs
  • LineUp.cs and StickFigure.cs
  • DrawShapes.cs
  • DrawStarsForm.cs
  • Lecture 25 (Oct 29) Graphical User Interface; Events  (6/page PDF, 2/page PDF, Powerpoint)
  • C# System.Drawing Namespace
  • C# System.Windows.Forms Namespace( Control, Button, ButtonBase, CheckBox, ComboBox, Form, Label, TextBox)
  • SimpleEventExample.cs
  • LabelTextBoxButtonTest.cs
  • GroupBoxPanelExample.cs
  • PictureBoxTest.cs (images)
  • KeyDemo.cs
  • RollDie.cs (images)
  • Lecture 26 (Nov 1) Widgets and Event Handling  (see Lecture 25)

  • Lecture 27 (Nov 3) Event Handling and Layout Manager  (see Lecture 25)

  • Lecture 28 (Nov 5) Recursive Programming  (6/page PDF, 2/page PDF, Powerpoint)
  • Tower of Hanoi applet (other math puzzles)
  • LotsOfPrintsDemo.cs
  • Lecture 29 (Nov 8) More on Recursion  (6/page PDF, 2/page PDF, Powerpoint)
  • PowerDemo.cs
  • Palindrome.cs
  • HanoiTowers.cs
  • ChangeMaker.cs
  • KochSnowflake.cs
  • Maze.cs and MazeMain.cs
  • ChessBoard.cs and KnightTour.cs
  • Lecture 30 (Nov 10) Multimedia and Animation  (6/page PDF, 2/page PDF, Powerpoint)
  • Boundcing Heads (Java applet, images)
  • Microsoft Agent Library
  • LogoAnimator.cs (images)
  • Lecture 31 (Nov 12) OO Programming and Inheritance  (6/page PDF, 2/page PDF, Powerpoint)
  • Book.cs, Dictionary.cs, and BookInheritance.cs.
  • FoodItem.cs, Pizza.cs, and FoodAnalysis.cs.
  • Thought.cs, Advice.cs, and ThoughtAndAdvice.cs
  • Academia.cs, Student.cs, and GradStudent.cs.
  • ShapePoly
  • PayRollAbstract
  • Lecture 32 (Nov 15) Inheritance; Class Hierarchy  (see Lecture 31)

  • Lecture 33 (Nov 17) Abstract Class; Interfaces  (6/page PDF, 2/page PDF, Powerpoint)
  • PayRollAbstract
  • AbstractShapesTest.cs, Shape.cs, Circle.cs, Cylinder.cs, and Point.cs
  • IAge.cs, Tree.cs, Person.cs, and InterfacesTest.cs
  • Lecture 34 (Nov 19) Data Structures  (6/page PDF, 2/page PDF, Powerpoint)
  • LinkedListLibrary.cs
  • ListTest.cs
  • Lecture 35 (Nov 29) More on Data Structures  (see Lecture 34)

  • Lecture 36 (Dec 1) Advanced Applications; Second Exam Review
  • .NET Compact Framework for programming your Pocket PCs.
  • ASP.NET for programming web applications
  • List of Covered Topics (Second Exam)

  • Last modified on August 31, 2004 by Zhong Shao, Dept. of Computer Science, Yale University.