Category: Programming

  • Example of overriding operators in C++ using a class that deals with fractions

    C++ allows for the ability to overwrite operators. This program shows an example using various operators in a class that deals with fractions. It also throws a runtime exception if a divide by zero is attempted. Running Source Code main.cpp fraction.h fraction.cpp

  • Abstract data types using typename in C++

    C++ has some really great advantages over languages like Java. It allows for abstract data types using the keyword typename. In this simple program, I create a class called Array and pass to it a typename and an integer to declare its size. I’m then able to assign array elements a value that corresponds to…

  • Binary Search in C++

    This is a recursive binary search algorithm written in C++. It only works with presorted lists going up in value. If the value is not found, it says it is at position -1. Bubble sort is a great way to sort small lists. You can see a bubble sort algorithm written in Java here: Running…

  • 2×2 Matrix in C++

    This is a fairly simple 2×2 matrix calculator written in C++ with the values hard-coded. Running Download You can copy the source code from below, or you can download it from here for $1. Be sure to click on “2×2 Matrix (source code)” in the dropdown list. Source Code main.cpp matrix.h matrix.cpp vector.h vector.cpp

  • Space Invaders (Java desktop app w/source code)

    The complete source code is below. The resources are not included, but you can see a hierarchy of what resources I used, along with their names, below. The download comes with a text file that includes the exact dimensions of each sprite, sprite sheet, and the sprites on each sprite sheet along with how many…

  • Circuit Breaker App (Java w/source code)

    The following was a program I wrote back in college. Press the ‘+’ button to add an appliance, and the ‘-‘ button to subtract the last appliance. Up to 30 appliances can be entered. All appliances showing will be calculated, whether or not they have anything in their fields, so be sure to add and…

  • Javascript code for VA Disability Rating Calculator

    On my VA Disability Rating Calculator post, there is program written in Javascript that calculates both the total by value and actual total of any amount of disabilities with a rating awarded by the Department of Veteran’s Affairs. The page running the code is here: And the source code itself can be easily copied from…

  • Basic animation Java game “Snake” (like Centipede for Windows), complete w/source code

    Package Hierarchy Root directory:SnakeMain.javasnake (folder) snake folder:enums (folder)gui (folder) snake\enums folder:KeyDirections.java snake\gui folder:Level.javaPoints.javaSnakeGUI.javaSnakePanel.java The Game Download If you don’t want to copy the source code below, you can download it from here for $1: Source Code SnakeMain.java KeyDirections.java Level.java Points.java SnakeGUI.java SnakePanel.java

  • Bubble Sort Algorithm in Java

    The worst case scenario in the time it takes to sort data with bubble sort is O(n²). It’s not best to use this type of sorting algorithm when you have a lot of data, but it’s efficient when you have a small amount of data. Whenever I make a game that has high scores, I…

  • Tetris Applet Source Code

    Applets are pretty much obsolete these days, but they can still be a good way to learn Java and coding. The following contains the code for a Tetris applet I made a long time ago in Eclipse. But first, here’s a screenshot of the applet running: If you don’t want to copy and paste the…