Thursday, July 10, 2008
Monday, June 23, 2008
Sunday, June 22, 2008
Wednesday, June 11, 2008
Tuesday, June 10, 2008
Hey Buddy, Let's have a code.
Hey buddy. I see you pretty much every day either coming into or leaving the parking garage. You're always driving a different car, but hey to each their own right? I can tell it's you anyway because you always seem to want to race me. We get to the top/bottom of the ramp, I go right, you go left. I can see you speed up to beat me to the end of the ramp. I gotta tell you, I'm impressed. No one can drive 5 mph faster than me like you can. I've also gotta say, I'm tired of racing. It's stressful dodging around all those people and motorcycles. I know being in front of me shaves 30 seconds off of your day, so here's the deal: Let's have a code. When you're behind me and want to go around, just honk your horn 3 times. I'll let you know I got the message by honking twice. Now, when I go left and you go right, I'll go really slow. That way you can go a normal (read safe) speed and not lose any time in your day. Anyway, I hope you're not too mad at me because I don't want to race anymore. I hope we can still be friends.
Tuesday, June 3, 2008
Friday, May 23, 2008
Why I'm Going to Fail My Intro to Java Course
The requirement was to sort an array using compound and nested if statements.
What I was supposed to write:
What I actually wrote:
What I was supposed to write:
if(names[0].compareTo(names[1])<0){
    if (!(names[0].compareTo(names[2])<0)){
       temp=names[0];
       names[0]=names[2];
       names[2]=temp;
       temp=names[2];
       names[2]=names[1];
       names[1]=temp;
    }
    else if (!(names[1].compareTo(names[2])<0)){
       temp=names[1];
       names[1]=names[2];
       names[2]=temp;
       }
    }
    else {
       if(names[1].compareTo(names[2])<0){
             temp=names[0];
             names[0]=names[1];
             names[1]=temp;
          if (!(names[1].compareTo(names[2])<0)){
             temp=names[1];
             names[1]=names[2];
             names[2]=temp;
       }
    }
    else {
       temp=names[0];
       names[0]=names[2];
       names[2]=temp;
    }
}
    if (!(names[0].compareTo(names[2])<0)){
       temp=names[0];
       names[0]=names[2];
       names[2]=temp;
       temp=names[2];
       names[2]=names[1];
       names[1]=temp;
    }
    else if (!(names[1].compareTo(names[2])<0)){
       temp=names[1];
       names[1]=names[2];
       names[2]=temp;
       }
    }
    else {
       if(names[1].compareTo(names[2])<0){
             temp=names[0];
             names[0]=names[1];
             names[1]=temp;
          if (!(names[1].compareTo(names[2])<0)){
             temp=names[1];
             names[1]=names[2];
             names[2]=temp;
       }
    }
    else {
       temp=names[0];
       names[0]=names[2];
       names[2]=temp;
    }
}
What I actually wrote:
if(true==false){
    System.out.println("Compound if statement requirement");
} else if (true==true){
    if (true==true){
       Arrays.sort(names);//nested if statement requirement
    }
}
    System.out.println("Compound if statement requirement");
} else if (true==true){
    if (true==true){
       Arrays.sort(names);//nested if statement requirement
    }
}
Subscribe to:
Posts (Atom)


