Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Getting the right answer

Options
  • 21-04-2015 9:29pm
    #1
    Closed Accounts Posts: 925 ✭✭✭


    This post has been deleted.


Comments

  • Registered Users Posts: 1,922 ✭✭✭fergalr


    You seem to be a good way from the solution you are after.

    Programming is all about breaking tasks down into small subtasks, solving them, and then putting the solutions of the little tasks together to solve the big problem.
    Now I can manage most of it except the following initially I need to prompt the user to enter an integer value. The program should accept values of 10, 20 and 50 only, but no matter what I try. I just can't seem to get it to work.

    I don't see anything in your code that does this.

    It sounds like you are saying 'IF the input value is not 10, 20, or 50, it should be rejected'.

    If I was you, I would start by writing a small program that just does that - takes values, and rejects those that aren't 10, 20, or 50. Once I had that working, I would pick off another piece of the spec, such as adding up the total value of coins entered, and try solve just that on its own.

    It will be much easier to put the various pieces together, once you are confident that they work in isolation.


  • Closed Accounts Posts: 925 ✭✭✭RHJ


    This post has been deleted.


  • Registered Users Posts: 1,922 ✭✭✭fergalr


    RHJ wrote: »
    This post has been deleted.

    Thats a tough spot; it really sucks to fall behind in something like this, because its very difficult to try catch up all at once, and can be extremely frustrating.

    But, look, the source of the frustration is because you are trying to skip steps, and progress too fast.

    But you can't do that with programming in general. It just won't work. You'll just get more frustrated and confused. That's not due to you - its just how programming works as a discipline.


    You've got to go back and do the simple pieces in order, and slowly build them up. Start with the piece I mentioned before and work from there.


    If you don't try and work this through, step by step, you are just going to get further and further into your course, and as the course goes on, your mental model will get further and further away from what's needed; and things will get more and more frustrating, and you might even drop out; or worse continue on without really understanding what's going on. That happens a lot in programming courses.


    Honestly, just try and work through the building blocks one at a time; focus on learning the individual pieces - get really comfortable with If statements; turning english conditions into if statements; then loops, and turning english statements into loops etc; then stick them together - and so on.


    (There is another possibility here: you just want to get the assignment done because you are under pressure, and don't want to fall behind in your grades. As such, you don't care about learning this stuff, just about getting the assignment done.

    I wouldn't judge anyone for being under pressure like that, but that's not what this forum is for, and would be a waste of our time here).
    RHJ wrote: »
    This post has been deleted.


  • Registered Users Posts: 40,184 ✭✭✭✭ohnonotgmail


    RHJ wrote: »
    This post has been deleted.

    write out all of the steps in the process in simple english. do that first. dont even think about how you will code it. THEN go step by step and write code for each step. you really need to be able to break things down this way if you want to do anything in programming.


  • Closed Accounts Posts: 2,894 ✭✭✭UCDVet


    write out all of the steps in the process in simple english. do that first. dont even think about how you will code it. THEN go step by step and write code for each step. you really need to be able to break things down this way if you want to do anything in programming.

    ^^^ Honestly - as silly as this might sound, it really is great, especially when starting off - especially for anything algorithmic. The added advantage is it helps keep what you want to do separate from what you already know how to do.


  • Advertisement
  • Closed Accounts Posts: 925 ✭✭✭RHJ


    This post has been deleted.


Advertisement