Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

anyone here good at computer programming?

  • 02-03-2016 08:06PM
    #1
    Registered Users, Registered Users 2 Posts: 234 ✭✭


    i have an assignment due and im stuck cant figure it out, if you're somewhat decent at programming please reply and i can send my code across, ive been told to use an if statement in a for loop


Comments

  • Registered Users, Registered Users 2 Posts: 637 ✭✭✭JaCrispy


    Reon wrote: »
    i have an assignment due and im stuck cant figure it out, if you're somewhat decent at programming please reply and i can send my code across, ive been told to use an if statement in a for loop

    Google it. For is a loop count e.g. for each number in 1-10 would run the code inside the for loop 10 times.

    Inside that for loop then you have an If statement - If drunk then fall down


  • Posts: 793 ✭✭✭ [Deleted User]


    Dude - at least make an effort. Explain what you are having a problem with, and what you've tried to fix the problem. Nobody's going to write your programming assignment for you. Also the development forum is probably a better spot for your question.


  • Registered Users, Registered Users 2 Posts: 234 ✭✭Reon


    this is what i have



    String[] bucky = {"Green Dice","Yellow Dice","Red Dice"};

    String[] Yellowdice = {"Brain", "Brain", "Run", "Run", "Shotgun", "Shotgun"};

    String[] Reddice = {"Shotgun", "Shotgun", "Brain", "Run", "Run", "Shotgun"};

    String[] Greendice = {"Brain", "Brain", "Brain", "Shotgun", "Run", "Run"};







    for(int i=0; i<1; i++)
    {
    int tempo=+rand.nextInt(6);
    int temp=+rand.nextInt(3);
    System.out.println("Dice 1 rolled="+bucky[temp]);


    }
    ===========
    and what i need to do is just say it lands on green dice it should have either brain, shotgun or run but has to be a random one


  • Registered Users, Registered Users 2 Posts: 234 ✭✭Reon


    Dude - at least make an effort. Explain what you are having a problem with, and what you've tried to fix the problem. Nobody's going to write your programming assignment for you. Also the development forum is probably a better spot for your question.

    i have the just of it done


  • Registered Users, Registered Users 2 Posts: 1,456 ✭✭✭FSL


    Draw yourself a flow chart of what the programme is supposed to do.
    Pay particular attention to ensuring you do not leave any loose ends when you have a conditional statement i.e. a question. For example a comparison has three results equal, less than or greater than.
    Convert the flowchart to a series of written statements describing the steps.
    Read the syntax of statements in the programming language you are supposed to use.
    Pay particular attention to the suggested statements.

    You should then be well on the way to producing the code.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 36,095 ✭✭✭✭ED E


    Reon wrote: »
    for(int i=0; i<1; i++)

    This line says you didnt listen in lectures, didn't attend or completely failed to comprehend the concept. If this is a degree course then you're 60 credits in and to be at that level is very very worrying.

    I suggest you start from the start of the module reading material and make sure you understand each page before continuing. There are rakes of great videos on youtube if you don't understand a concept.


  • Registered Users, Registered Users 2 Posts: 760 ✭✭✭mach1982


    Like everyone else said , try Google , it's your friend when it comes to programming there some great videos out there.

    New Boston , Derek Banas ( and no I not link them)


    if that fails find you local Coder Dojo , I am some kids there might be willing to help you :p


  • Registered Users, Registered Users 2 Posts: 1,462 ✭✭✭Asmooh




Advertisement