Skip to content

Latest commit

 

History

History
66 lines (39 loc) · 5.89 KB

README.md

File metadata and controls

66 lines (39 loc) · 5.89 KB

Java

Intermediate and Advanced Java Application Examples

This repository contains examples that you can use to test out Java with. Each package contains a small application that should run on most any operating system that supports Java desktop or server environments. The repository serves two primary purposes:

  1. A code-snippet store for my reference
  2. Code examples for aspiring Java developers that want something more than just "Hello World" to play with.

All of the examples are either labs, dev-book problems, or common application needs I've run across. While the problem source may differ, I wrote all of the solutions as presented in the repository. As time allows, more advanced topics will be added.

Required Tools

All of the applications were written using Eclipse Oxygen, IntelliJ IDEA or NetBeans.

The Java version used for both Windows and Linux (at the time of testing) was Version 8 Update 151. No external libraries are needed nor used unless otherwise noted.

Classification

Unlike my dotnet-core-example respository, the Java examples provide both Console and Graphical examples. Additionally, the code complexity moves from Intermediate to advanced rather quickly. However, the same simplistic classification (from a new developer standpoint) exists. Professional and experienced OOP Developers should consider the examples intro-level. New Developers, or those switching over to OOP Development could think of them in terms of:

  • Intermediate - employs things such as structures, and methods from outside of the main method, in addition to simple class instantiation.

  • Advanced - implements main methods, Class objects, interfaces, abstract classes and methods, IS-A relationships (Inheritance), Has-A relationships (association), or any combination thereof.

The code for each application is Verbose, meaning, shortcuts and advanced concatenations have been kept to a minimum to allow for easier readability. Code comments are also brief, but should suffice for most readers.

For easy separation of classes, each application has its own package. Each program collection also has its on "Driver" (entry point). Most often, the name takes the form of (AppName)Driver.java. On occasion, the entry point is simply named Driver.java

How to Run Examples

The easiest way to run the applications is from an IDE. Simply import the projects (ConsoleApps and GuiApps) into your IDE, browse to the src/ folder, then expand the package you want to test. This is true for both console and UI packages.

Example List

Graphical Interface Examples

Console Application Examples

  • (Intermediate) Salary Tests - is a simple test application. It employs class instantiation, and static methods to test three different conditions.

  • (Intermediate) Airline Reservation - is a single-file seat assignment app. It employs boolean arrays, input scanners, random number generators, and static methods.

  • (Intermediate) Calculate Sales - is a product sales calculator. It employs an input scanner, while-loops, for-loops, switch, and if-else statements.

  • (Intermediate) Hourly Salary - is a pay calculator that allows for multi-employee input. It employs an input scanner and while-loop.

  • (Intermediate) Parking Garage - is a parking fee calculator. It employs an input scanner, while-loop and it-statements.

  • (Advanced) Animal Sighting - is an application that counts animal sightings and prints the totals. It uses ArrayLists, input scanners, while-loops, class instantiation, Object, hashCode, and toString overrides.

  • (Advanced) Domain Purchase - in an invoicing example application. It implements an Interface, Abstract Method, random generator, for-loops, and static methods.

  • (Advanced) Gross Pay - is a gross pay calculator that uses three different pay types: S=Salary, H=Hourly, C=Commission. It extends (has-a) an Employee class, uses an Abstract Method, for-loops, and switch statements.

  • (Advanced) Radio Station - is a station inventory and cost application. It employs class instantiation, ArrayLists, and if-else statements.