Thursday, January 2, 2014

First!

January 2, 2014.
      I've been trying to learn to code for a while now, and I haven't made as much headway as I would like; so I'm going to use this blog as a narcissistic way to keep myself on track. I'm trying to learn .js and get some knowledge under my belt. I am an absolute n00b. I'm just now getting comfortable with variables and functions. Right now I'm using code academy, Udacity and random stack overflow places that answer my urgent Google searches. My current hardware is a Chromebook Pixel. Boom. Yup, on a Pixel. All my classes are online so, right now I don't need any hardware-specific. When I need something like BlueJay (or whatever it's called) I'll just use Crouton! Linux FTW! 
I'm going to start with a M-W-F schedule and we'll see where it goes from there. Expect screenshots, strange comics, and anecdotes with a hint of Southern in there. 
A little about my person.
I am twenty four, I live with my parents in the boondocks of Texas. Or, as the Australians would put it, waaay past the black stump! I work in general construction right now, but obviously want a better job. I'm aiming at front-end web development and once I have that down(ish) I want to go forward with android app development. hopefully by this time next year, I'll be in a better place.
So, to start, I'm going to go jam some Pink Floyd and get some class work done.
Here's what I worked on today:
// add a parameter called hourOfDay to the function
var taxiFare = function (milesTraveled,hourOfDay) {
  var baseFare = 2.50;
  var costPerMile = 2.00;
  var nightSurcharge = 0.50; // 8pm to 6am, every night
  var cost = baseFare + (costPerMile * milesTraveled);
 
  // add the nightSurcharge to the cost starting at
  // 8pm (20) or if it is before 6am (6)
 if (hourOfDay>=20||hourOfDay<6)
 {
     return nightSurcharge+ baseFare + (costPerMile * milesTraveled);
 }else{

  return cost;
}
};
console.log(taxiFare(12,13));
It's not exactly elegant, but I got it to work!
the idea was to get taxiFare to print out the bill and have the option to put in time of day. That if(hourOfDay) bit had we stuck for a while! But, I'm through it. =-)
--Martin