In danger of failing my computer programing class

edited November 2014 in General Discussion

hello I was originally in a history class and i switched it out about 4 weeks int school for a intro to computer programing class, lets just say they were so far ahead of me already i knew there was no way of me catching up and learning the materiel to be able to do what i needed to. if anyone is willing to take time to help me get my projects finished i would be grateful. i have told my dad about this and there is no possible way to get a decent grade for me. i know i wont pass this course with out "help". I have asked the teacher for help and he simply does not supply the answers i need. we are already in the second term and i have the knowledge of someone who just started. Ive bull shited my way through the other projects, but now things are getting to test our knowledge on the course and i will fail with out some miracle. if there is anyway someone gets the time to help me with my problem like i said you would be a miracle.

Tagged:

Answers

  • edited November 2014

    Let's start with the basics then! How do you bake a cake? A good start would be to find a cookbook that has the directions you need to bake a cake. Once you have a cookbook with directions to make the cake, all you need to do is follow the directions. Here is what my cookbook says:

    1) Put the oven on.
    2) Get 2 eggs.
    3) Get 3 cups of flour.
    4) Get 4 and a half cups of sugar.
    5) Mix the eggs, flour, and sugar in a cake tin.
    6) Put the cake tin in the oven.
    7) Remove after 10 minutes.
    8) Turn the oven off.
    9) Put frosting on the cake if you like!
    

    (NOTE: NOT A REAL RECIPE - DO NOT ATTEMPT TO COOK)

    Programming is a lot like cooking. The difference is that you need to supply the recipe for the computer to follow. The computer, however, is a lot more clueless than a cook, so you have to give it VERY exact directions. For example:

    boolean oven = true;
    int eggs = 2;
    int flour = 3;
    float sugar = 4.5;
    CakeTin myTin = eggs + flour + sugar;
    tin.place_in( oven );
    delay( 1000 * 60 * 10 );
    oven = false;
    if( you.like_frosting ){
      cake.add( new Frosting() );
    }
    
    // (NOTE: NOT REAL CODE - DO NOT ATTEMPT TO COMPILE)
    

    The trick is to know what you want your computer to do, and then to give it the right directions to do that. If it does the wrong thing - that is, it does something that you didn't want - then it's your fault for telling it the wrong directions!

    More coming...

  • (REAL CODE FROM THIS POINT ON - FEEL FREE TO COPY ANY CODE BLOCK INTO PROCESSING EDITOR AND RUN THEM!)

    So let's start with some basic directions. First, we'll start with a command that prints out a string.

    println( "Hello World!" );
    

    Notice that the direction is to PRINT a LiNe that says "Hello World!". Note also that this direction ends with a semicolon;

    Now we'll do the an if statement. This tells the computer to do something IF some conditions are met.

    if( 1 + 1 == 2 ){
      println( "Yes, 1 + 1 is 2" );
    }
    if( 2 + 2 == 5 ){
      println( "Yes, 2 + 2 is 5" );
    }
    

    Next, else. This does something ELSE if the conditions are not met:

    if( 2 + 2 == 5 ){
      println( "Yes, 2 + 2 is 5" );
    } else {
      println( "No, 2 + 2 is NOT 5" );
    }
    

    More coming...

  • edited November 2014

    Computers are very good at remembering things, but only if you tell them to remember them properly! Here's some code to tell the computer to remember a number, a decimal number, a single letters, and a whole bunch of letters:

    int just_a_number = 45;
    float a_decimal_number = 2.38;
    char a_single_letter = 'd';
    String my_name = "TfGuy44";
    
    println( "I remember your name! You're " + my_name );
    

    Computers, unlike cooks, are very good at doing the same things over and over. The hardly even get tired! You can make computers do the same things over and over using loops. Here is a while loop:

    int counter = 0;
    while( counter < 100 ){
      println( counter );
      counter++; // Increase the number called counter by 1.
    }
    

    Whoa, what's that?!? That looks like a real sentence, not a direction! And the computer didn't even notice it! That's a comment - think of it like a note left in the cookbook to remind you of something, but since it's not part of the directions, the computer ignores it.

    More coming...

  • Processing has a few functions built-in that are useful. The two main ones are setup() and draw(). Think of these as groups of directions - each is its own recipe - that the computer is going to make. It makes setup() just once, first. It then makes draw() over and over, as fast as it can.

    void setup(){ // This happens just once.
      size(400,600); // This tells the computer how big you want the window to be. 400 pixels by 600 pixels.
    }
    
    void draw(){ // This happens over and over.
      background(0); // Draw the background black.
      rect(mouseX, mouseY, 50, 50); // Draw a RECTangle where my mouse is.
    }
    

    That's it! Basics covered. Now muck about for a hour with that, read the reference, and try to write some of your own recipes... er, code. I'll be back in a hour to see where you're at.

    Gone fishing... back in an hour...

  • Hey TFGUY I really appreciate you helping out like this. Azael, would you like to join our programming group? There we can help you out, do your projects as a group, and guide you just like tfguy is doing. Then you can be including in producing software and games. What do you say? If you're interested email here: portalswwd@gmail.com

  • hey, buddy, we're here to help you!

    I'm also in this programming group TechWiz told you about.

    Besides, did you do the first 6 tutorials?

    They are great!

    And then, it's all about practicing. When you like plan 2 hours of programming every second day, you'll soon be ahead of the crowd.

    Best bring an example program you have issues with.

    Or we give you a task like tetris or so.

    Chrisir ;-)

Sign In or Register to comment.