Java Programming I on YouTube:
https://www.youtube.com/playlist?list=PLLIqcoGpl73iaXAtS_-V_Xdx3mhTzPwb5
Object-Oriented Java Programming I Sample Code
My first Java programs
-
Main.java
(download) Hello!
-
Hello2.java
(download) Hello program modified: prints a blank line
Variables
-
VariablesDemo.java
(download) Sample Java program using data variables
static methods and local variables
-
MainApp.java
(download) Sep 2016 demo code
-
MainApp_wk05.java
(download)
Console I/O and the Scanner class
-
TheScanner.java
(download) Scanner, nextInt(), next(), nextLine()
-
TheNumbers.java
(download) Scanner, Integer, System.out.printf()
Multiply two numbers by adding them
-
MultiplyMain.java
(download) Demonstrates endless loop for( ; ; ) and while( condition )
Floating point rounding and precision
-
Rounding.java
(download) BigDecimal RoundingMode HALF_UP HALF_EVEN
-
BigDecimalMath.java
(download) How to avoid ArithmeticException with BigDecimal
Assignment a5 Temperature Converter demo
-
a5_temperature_demo.java
(download) BigDecimal demo to convert Fahrenheit to Celsius
Baseball demo application
-
BaseballApp.java
(download) main driver program
-
BaseballPlayer.java
(download) abstract class BaseballPlayer
-
Pitcher.java
(download) concrete class Pitcher
-
Catcher.java
(download) concrete class Catcher
Banking exception demo
-
Main.java
(download) Java exception demo program
-
Customer.java
(download) Customer class
-
Account.java
(download) Account class
-
OverdrawException.java
(download) OverdrawException class
Dice Roller App Sample
-
Main.java
(download) Main driver
-
DicePair.java
(download) DicePair class
-
Die.java
(download) Die class
-
Menu.java
(download) Menu class
Using DicePair with rollSeries() Nov 10 2015
-
Main.java
(download) Main driver
-
DicePair.java
(download) DicePair class with rollSeries() method
-
Die.java
(download) Die class
-
Menu.java
(download) Menu class
-
Validator.java
(download) Validator class: user input handling and validation
Using Comparable interface to sort objects
-
MainApp.java
(download) Main driver
-
DicePair.java
(download) DicePair class
-
Die.java
(download) Die class
-
DiceRoller.java
(download) class DiceRoller
-
Stats.java
(download) class Stats implements Comparable<Stats> - Fall 2014
Using Comparable interface Fall 2015
-
Main.java
(download) Main driver
-
DicePair.java
(download) DicePair class
-
Die.java
(download) Die class
-
Stats.java
(download) class Stats implements Comparable<Stats> - Fall 2015
-
Menu.java
(download) Menu class
-
Validator.java
(download) Validator class: user input handling and validation
Car Inventory Sample
-
CarMain.java
(download) Main driver
-
Car.java
(download) Car class, constructor, setters and getters for each attribute
Using "this" reference to pass object to a method
-
Main.java
(download) Main driver creates a Product and calls print( )
-
Product.java
(download) Product class, its constructors, and print( ) method
-
LaserPrinter.java
(download) LaserPrinter class and print( Product ) method
Integer array and Rectangle object array
-
DemoArrays.java
(download) Main driver
-
Rectangle.java
(download) Rectangle class, constructor, setters/getters, and compareTo
Array of ordered Die objects
-
MainApp.java
(download) Main driver
-
Die.java
(download) class Die implements Comparable
Array Reference Demo I
-
ArrayReferences.java
(download) Array initialization and enhanced (foreach) loop examples
Array Reference Demo II
-
EnhancedForLoops.java
(download) Array initialization, standard "for" and enhanced "foreach" loop examples
NumberFormat rounding
-
NumberFormatDemo.java
(download) Miscellaneous rounding examples
List, Iterator, Generic Box Container
-
MainApp.java
(download) Main driver
-
Box.java
(download) class Box < T >
Queue Object Demo
-
MyGenericQueueApp.java
(download) Main driver: push and pull from the queue
-
MyGenericQueue.java
(download) MyGenericQueue class
-
Rectangle.java
(download) Rectangle class, constructor, setters/getters, and compareTo
Stack Object Demo
-
GenericStack.java
(download) GenericStack class
-
GenericStackApp.java
(download) Main driver: push and pop from the stack
LinkedList of Rectangle objects
-
LinkedListDemo.java
(download) Main driver: LinkedList operations
-
Rectangle.java
(download) Rectangle class, constructor, setters/getters, and compareTo
List interface
-
ListDemoL.java
(download) Main driver: List operations
-
Rectangle.java
(download) Rectangle class, constructor, setters/getters, and compareTo
Map, HashMap, TreeMap, Map.Entry
-
MainApp.java
(download) Main driver
-
Validator.java
(download) Validator class: user input handling and validation
ArrayList of Rectangle objects
-
ArrayListDemo2.java
(download) Main driver: ArrayList operations
-
Rectangle.java
(download) Rectangle class, constructor, setters/getters, and compareTo
-
Validator.java
(download) Validator class: user input handling and validation
ArrayList of Rectangle objects v.2
-
SquaresDemo.java
(download) Main driver: ArrayList as method parameter and as a return type
-
Rectangle.java
(download) Rectangle class, constructor, setters/getters, and compareTo
ArrayList of ints
-
ArrayListDemo.java
(download) Main driver: ArrayList operations
-
Validator.java
(download) Validator class: user input handling and validation
Algorithm: swap elements of array in place
-
Main.java
(download) Main driver demo
Sorting Comparable Objects
-
Main.java
(download) Array of products, foreach loop, Arrays.sort( ) demo
-
Product.java
(download) class Product implements Comparable
-
Product2.java
(download) Another class Product2 that implements "sort by" feature
Using Arrays.copyOf( ) Arrays.fill( ) Double.isNaN( )
-
Main.java
(download) Arrays can be zero length -- be careful when using array's length in formulas!
11/29/2012 Polymorphism
-
Main.java
(download) Creates array of Shapes, computes total area of Shapes
-
Shape.java
(download) interface Shape
-
Rectangle.java
(download) class Rectangle implements Shape
-
Circle.java
(download) class Circle implements Shape
Assignment a8 -- Airline Flight Schedule demo Dec 9 2014
-
MainApp.java
(download) Airline Flight Schedule Prototype
-
FlightSchedule.java
(download) class FlightSchedule
-
Flight.java
(download) class Flight
-
Airline.java
(download) class Airline
-
Menu.java
(download) class Menu
-
Validator.java
(download) Validator class: user input handling and validation
-
DepartureArrivalInfo.java
(download) class DepartureArrivalInfo
Assignment a8 -- Airline Flight Schedule demo
-
Main.java
(download) Result of experimentation with collections in class on Fri, Nov 20, 2012
-
FlightSchedule.java
(download) Flight Schedule which can produce sorted ArrayList of departures
-
Flight.java
(download) class Flight implements Comparable
-
ClassPrototypes.java
(download) Thursday 11/29/2012 -- a design that maintains maps of departures and arrivals in the schedule
-
ClassPrototypes2.java
(download) Friday 11/30/2012 -- another design that creates sorted ArrayList of departures
selectionSort(), insertionSort( ), and binarySearch( ) demo
-
Main.java
(download) Array of integers sorted, then searched
Java Generics demo
-
Main.java
(download) Uses GenericQueue, PriorityQueTree, PriorityQueHash
-
GenericQueue.java
(download) class GenericQueue
-
PriorityQueTree.java
(download) class PriorityQueTree
-
PriorityQueHash.java
(download) class PriorityQueHash *** WRONG implementation -- use PriorityQueTree instead, because HashMap isn't a sorted container!
Assignment a8 -- Airline Flight Schedule demo Verion 2
-
Main.java
(download) Airline Flight Schedule Prototype as of Fri, Dec 14, 2012
-
FlightSchedule.java
(download) Flight Schedule which can produce sorted ArrayList of departures
-
Flight.java
(download) class Flight implements Comparable
-
DepartureArrivalInfo.java
(download) class DepartureArrivalInfo
-
Airline.java
(download) class Airline
-
AirlineReports.java
(download) class AirlineReports
-
UserMenu.java
(download) class UserMenu
Assignment a8 -- Fall 2015
-
Main.java
(download) Main class
-
FlightSchedule.java
(download) Flight collection of airlines and flights
-
Flight.java
(download) class Flight
-
DepartureArrivalInfo.java
(download) class DepartureArrivalInfo
-
Airline.java
(download) class Airline
-
UserMenu.java
(download) class UserMenu
-
Validator.java
(download) Validator class: user input handling and validation