Hello. Time to program.

package com.queue;

public class firstClass {

public static void main(String[] args) {


    int firstCar = 15000;
    int secondCar = 30000;

    int firstMPG = 10;
    int secondMPG = 50;

    int gasPrice = 4;
    int miles = 50000;

    System.out.println("The numbers are:");
    System.out.println(firstCar + " is the first car's cost," + " " + secondCar + " is the second car's cost " + firstMPG + " is the first MPG, and " + secondMPG + " is the second, while you are travelling " + miles + " miles, on " + gasPrice  + "mi/gal");

    int gasCost1 = (miles / firstMPG) * gasPrice;
    int gasCost2 = (miles / secondMPG) * gasPrice;

    int totalCost1 = firstCar + gasCost1;
    int totalCost2 = secondCar + gasCost2;

    System.out.println("The Price is " + totalCost1 + " for car 1");
    System.out.println("The Price is " + totalCost2 + " for car 2");

    if (totalCost1 < totalCost2) {

        System.out.println("Buy car 1");

    } else {

        System.out.println("Buy car 2");


This is a program. And a damn n00bish one at that.

This is a little Java program I wrote for a Udacity course on Java programming that I have been taking online. It is in response to an algorithm that we were supposed to write out in pseudocode, but I said nope to that and wrote it in Java instead.

As it turns out, I was able to using prior Java knowledge write a freakishly simple program to compute some costs for 2 different cars. The program runs well, with no issues and I think I did my best.

Of course, anyone with programming experience will instantly realize the issues (namely best coding practices for variables), but all decisions here were intentional here, based purely on the idea of doing exactly what the instructor’s algorithm did just translated literally into Java. This aside, however, the thing I love about this program (besides being the first real thing I have done in programming that was done start to finish without looking anything up that wasn’t Python or web programming) is how much it taught me. This program is the single best example that I can think of as to why it is better to learn programming via experience rather than purely book learning.

University classes and online classes are nearly there, doing 50% lecture/“book” learning, and the rest actual programming, but I believe that the majority of your programming when you start out needs to be just getting things down in an IDE/TextEditor (I used SublimeText 3 and intelliJ Idea here). This is how I taught myself all of my web languages, and albeit much harder than that, this is how I believe full fledged languages should be learned.

This program uses logic, variables, output, math, and most of the main components of a Java program (even packages, which are totally unnecessary here), and it uses them all simply and cleanly together in one short program to solve an issue. This is what programming is about, at least at first. Solving problems elegantly and learning a thing or two whilst doing it.

Good day.


Now read this

Play to win

I love World of Tanks. Few games have gotten me hooked in my lifetime, and Word of Tanks deserves a spot in that sacred list. It started with MLB ‘06 The Show on the Playstation 2. But console games do not count. It started with... Continue →