Software Development and Programming have been important components of my undergraduate education and work life:

  • CSC 1253/1254 (Object Oriented Development)
  • MATH 2060 (Mathematica Programming)
  • MATH 4025 (Optimization)
  • MATH 4065 (Numerical Analysis)

And during my internship at the Naval Research Laboratory, I was exposed MatLab, LaTeX, and Python. Overall, I have significant experience with C++, Mathematica, MatLab, HTML/CSS, LaTeX, and Python. At times I've made creative decisions with my coding, and at other times I've had to implement a given algorithm.

Evolutionary Optimization Algorithm in Mathematica

This was my term paper/project in MATH 4025: Optimization. It's my original algorithm and implementation, complete with usage instructions.

The code itself is pretty horrid, because it was my first experience using Mathematica to create a large program. It wasn't until this project that I learned that Mathematica really should be used as a functional programming language.

The following screenshot is of the opening documentation of the Mathematica notebook. It does get quite wordy (as per the professor's request):

To use the code yourself, download the .nb file here. Personal use only, of course.

Detailed explanation can be found in the accompanying 10-page documentation/report.

Object Oriented (C++) code sample

From an assignment done in CSC 1253/4: Intro to Object Oriented Programming. See how I've kept functions short and easy-to-read, as well as maintaining meaningful alignment and writing descriptive function and variable names. Some of the comments seem redundant, since many parts can be read and understood by someone with no C++ background!

This first sample is a main project file, which #includes some (not listed) custom-made classes like List (a linked list) and Lawn (a client).

    //****************************************************************************
    // File:       program6.cc
    // Author:     Andrew Elias
    // for:        CSC 1254 - Coretta Douglas
    // Assignment: 6
    // Due:        Nov 22 2011, then Dec 2 2011 
    //
    // Client management program for Green Keepers, Inc. Allows a user to add, 
    // delete, update, and view clients after loading them from a file.
    //
    //****************************************************************************
    
    #include "Lawn.h"
    #include "List.h" 
    #include <stdlib.h>
    #include <iostream>
    #include <string>
    #include <ostream>
    #include <fstream> 
    using namespace std;
    
    //For use with menu responses; possible menu options to be entered by user:
    enum responses {DUMMY, ADD, UPDATE, DELETE, VIEW, VIEWALL, EXIT};  
    
    //Prototypes:
    void   greetUser();
    List   loadListFromFile();
    int    getUsersChoice();
    void   addClientMenu(List &clientList);
    double getAndCheckBasePrice(string type);
    int    getServiceTypeMenu();
    void   deleteClientMenu(List &clientList);
    void   updateClientMenu(List &clientList);
    void   viewClientMenu(List   &clientList);
    bool   presentProcessingMenu(List &clientList);
    
    
    int main() {
       greetUser();
    
       List clientList = loadListFromFile();  
    
       clientList.displayAllTo(cout); 
    
       bool userWishesToContinue = true;
       while(userWishesToContinue) {
          userWishesToContinue = presentProcessingMenu(clientList);
       }
    
       cout << "\nGoodbye.\n\n"; 
    }
    
    
    //****************************************************************************
    // Greet the user at the start of the program
    //****************************************************************************
    void greetUser() {
       cout << "\n";
       cout << "****************************************************************\n";
       cout << "* Welcome to the Green Keepers, Inc. service management program.\n";
       cout << "****************************************************************\n";
       cout << "\n";
    }
    
    //****************************************************************************
    // Loads a list of clients from a file and returns it.
    // Returns the list that was loaded.
    //****************************************************************************
    List loadListFromFile() {
       ifstream infile;         //stream for loading from a file
       infile.open("Lawn2011.data"); 
          if(infile.fail()) {
             cerr << "\nProblem loading Lawn2011.data\n\n";
             exit(1); 
          }
    
       List list;               //the list to be returned
       
    
       //Create the clients from the file data and load them into a ClientList
       //The following are temporary holder variables for file i/o:
       int intHolder;       
       string stringHolder;
       double doubleHolder;
       while(infile >> intHolder) {
             Lawn beingLoaded;
             beingLoaded.ID = intHolder;
          infile >> stringHolder;  beingLoaded.name = stringHolder;   
          infile >> doubleHolder;  beingLoaded.serviceTypes[0].basePrice    = doubleHolder;
          infile >> intHolder;     beingLoaded.serviceTypes[0].serviceCount = intHolder;
          infile >> doubleHolder;  beingLoaded.serviceTypes[1].basePrice    = doubleHolder;
          infile >> intHolder;     beingLoaded.serviceTypes[1].serviceCount = intHolder;
          infile >> doubleHolder;  beingLoaded.serviceTypes[2].basePrice    = doubleHolder;
          infile >> intHolder;     beingLoaded.serviceTypes[2].serviceCount = intHolder;
          list.add(beingLoaded);
       }
    
       infile.close();
       return list;
    }
    
    
    //****************************************************************************
    // Prompt the user to find out what they want to do.
    // Returns their choice, in integer form. 1=ADD, 2=VIEW, 3=EXIT
    //****************************************************************************
    int getUsersChoice() {
       cout << "\nEnter the number corresponding to what you would like to do:\n"
          << "1. ADD a client\n" 
          << "2. UPDATE a client's service count\n" 
          << "3. DELETE a client\n" 
          << "4. VIEW a client\n"
          << "5. VIEW ALL clients\n"
          << "6. EXIT; I'm done\n"
          << "\n";
    
       int choice;    //holder variable for user i/o
       cin >> choice;
       return choice;
    }
    
    //****************************************************************************
    // Allows the program to check service base prices to see if they fall in the 
    // ...acceptable range.
    //****************************************************************************
    double getAndCheckBasePrice(string type) {
       cout << "What is this client's BASE PRICE for " << type << " service?\n";
       double doubleHolder;           //temp holder variable for user input, to be able to check its value
       cin >> doubleHolder;
       while(doubleHolder<=0 || doubleHolder>1000) {
          cout << "Sorry, that base price does not fall in the possible range (0 to 1000). Enter another one.\n";
          cin >> doubleHolder;
       }
       return doubleHolder;
    }
    
    //****************************************************************************
    // Presents a series of questions allowing the user to add a client to the list.
    // Inupts:
    //         clientList:    the list to be mutated
    //****************************************************************************
    void addClientMenu(List &clientList){
    
       Lawn toAdd;             //an empty client for attributes to be put into
       cout << "\n";           //just for good whitespace
       cout << "What is the client's NAME?\n";
       cin >> toAdd.name; 
    
       cout << "What is the client's ID?\n";
       int idHolder;          //holder variable for id, to be able to check its value.
       bool idSuccessfullyEntered = false;
       while(!idSuccessfullyEntered){
          cin >> idHolder;
          if(idHolder>0 && idHolder<999) {
             toAdd.ID = idHolder; 
             idSuccessfullyEntered = true;
          } else cout << "ID should be >0 and <999. Please re-enter.\n";
       }
       toAdd.serviceTypes[0].basePrice = getAndCheckBasePrice("FULL");
       toAdd.serviceTypes[1].basePrice = getAndCheckBasePrice("BASIC");
       toAdd.serviceTypes[2].basePrice = getAndCheckBasePrice("ECONOMY");
    
       //Zero their service counts at the start.
       for(int i=0; i<=2; i++) toAdd.serviceTypes[i].serviceCount = 0;
    
       if(!clientList.add(toAdd)) cerr << "\nERROR: someone with that ID already exists\n\n";
    }
    
    
    //****************************************************************************
    // A submenu, called from within the update menu. 
    // Returns an integer corresponding to service type that the user wants to 
    // ..update
    //****************************************************************************
    int getServiceTypeMenu(){
       cout << "\nWhich service type would you like to update (it will be incremented by 1)?\n" 
            << "1. FULL service\n"
            << "2. BASIC service\n"
            << "3. ECONOMY service\n";
    
       int    serviceTypeChosen;
       cin >> serviceTypeChosen;
      
       //Subtract one to account for zero-based array indexing
       return serviceTypeChosen - 1; 
    }
    
    
    //****************************************************************************
    // An interactive submenu for updating a client
    // Input:
    //         clientList:   the list to be mutated
    //****************************************************************************
    void updateClientMenu(List &clientList){
       cout << "\nWhat is the ID of the client you would like to UPDATE?\n";
       int idHolder;               //holder variable for getting user input
       cin >> idHolder;
    
       Lawn* ptrToClientToUpdate;  //used for search()'s return parameter
       bool userExists = clientList.search(idHolder, ptrToClientToUpdate);
    
       if(userExists){
          int serviceTypeToUpdate = getServiceTypeMenu();
          (ptrToClientToUpdate->serviceTypes[serviceTypeToUpdate].serviceCount)++;
       } else{
          cout << "\nERROR: That user doesn't exist yet. Maybe try ADDing him/her first.\n";
       }
    }
    
    //****************************************************************************
    // An interactive submenu for deleting a client
    // Input:
    //         clientList:   the list to be mutated
    //****************************************************************************
    void deleteClientMenu(List &clientList){
       cout << "\nWhat is the ID of the client you would like to DELETE?\n";
       int idToDelete;          //holder variable for user input
       cin >> idToDelete;
    
       clientList.remove(idToDelete);
    }
    
    //****************************************************************************
    // Submenu allowing the user to view a single client, based on that client's ID.
    // Searches through 'clientList' for the client.
    //****************************************************************************
    void viewClientMenu(List &clientList){  //copy-constructor was causeing problems when & was not used
       cout << "\nEnter the ID for the client you would like to view.\n";
       int idToView;          //dummy variable for user input
       cin >> idToView;
    
       Lawn* ptrToClient;  
       ptrToClient = NULL; 
       bool clientIsInList = clientList.search(idToView, ptrToClient); 
    
       if(clientIsInList){
          clientList.printHeaderTo(cout);
          ptrToClient->displayOnALineTo(cout);
       } else{
          cout << "\nSorry that client is not in the list.\n";
       }
    }
    
    //****************************************************************************
    // Present a main menu (to be looped through), directing the user to 
    // ...various submenus which allow ADD, VIEW, and EXIT operations.
    // Inputs:
    //         clientList:   the list to be mutated
    //****************************************************************************
    bool presentProcessingMenu(List &clientList) {
       bool keepGoing = true;     //only set to false when the user wants to exit
       int chosenOption = (int)getUsersChoice();  //the int typecasting prevents errors when user enters a double
       
       switch(chosenOption) {
          case ADD:
                   addClientMenu(clientList);
                   break;
          case UPDATE:
                   updateClientMenu(clientList);
                   break;
          case DELETE:
                   deleteClientMenu(clientList);
                   break;
          case VIEW:
                   viewClientMenu(clientList);
                   break;
          case VIEWALL:
                   clientList.displayAllTo(cout);
                   break;
          case EXIT:
                   keepGoing = false;
                   break;
          default:
                   cout << "\nThat is not an option. Choose again.\n";
                   break;
       }
       
       return keepGoing;
    }
    

MatLab code sample

This was done as an assignment in MATH 4056: Numerical Analysis. It computes the LU factorization of a matrix, and solves a system of linear equations. Some of the parameters/variables were named according to the professor's request, and thus are not as descriptive as I would've made them. I also would avoid making a function that performs two tasks. Note that some of it is easier to understand if you are familiar with LU factorization.

I don't have code-highlighting for this one, but the comments and alignment still help communicate the code's message.

function[fact,soln] = Elias_LU(A,b)
% A:    an nxn matrix
% b:    an n-length column vector
% fact: the LU factorization, stored in one matrix
% soln: the solution (column vector) to Ax=b

    n = length(b);
    fact = zeros(n,n);
    soln = zeros(n,1);

    % Build a logical matrix which identifies which elements of 'fact' belong to L, and which to U
    [col,row] = meshgrid(1:n,1:n);
    lMaker = row > col;     % lMaker discriminates between L and U elements in 'fact'  

    % Do the first row & column:
    fact(1,1) = A(1,1);   % Because L[1,1] is assumed to be 1
    for j = 2:n
        fact(1,j) = A(1,j);
        fact(j,1) = A(j,1)/A(1,1);
    end
    if(fact(1,1) == 0)
        display('Factorization impossible');
        return;
    end

    % Do all the rows & columns up until the last one:
    for i = 2:(n-1)
        fact(i,i) = A(i,i) - dot(fact(i,1:(i-1)), fact(1:(i-1),i)'); 
        if(fact(i,i) == 0)
            display('Factorization impossible');
            return;
        end

        L = fact.*lMaker + eye(n);   
        U = fact.*~lMaker;

        for j = (i+1):n
            % Do a row
            fact(i,j) =  A(i,j) - dot(L(i,1:(i-1)), U(1:(i-1),j)); 
            % Do a column
            fact(j,i) = (A(j,i) - dot(L(j,1:(i-1)), U(1:(i-1),i)))/U(i,i);    %the last U could be fact. TODO
        end
    end

    % Do the last row & column:
    fact(n,n) = A(n,n) - dot(fact(n,1:(n-1)), fact(1:(n-1),n));
    % Note: if fact(n,n)==0, A is singular, but still factorized correctly.
    if(fact(n,n)==0)
        display('A is singular, but still factorized correctly');
    else
        L = fact.*lMaker + eye(n);   %TODO: how to not repeat this code?
        U = fact.*~lMaker;

        % Compute the solution (by breaking it into two simple systems that can each be solved by substitution)
        y(1) = b(1);
        for i = 2:n
            y(i) = b(i) - dot(L(i,1:(i-1)), y(1:(i-1)));
        end
        soln(n) = y(n)/U(n,n);
        for i = (n-1):-1:1
            soln(i) = (y(i) - dot(U(i,(i+1):n), soln((i+1):n)))/U(i,i);
        end
    end
end %End of function