Logic Development in terms of Java

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Shepard
    New Member
    • Feb 2013
    • 24

    Logic Development in terms of Java

    Hi Guys....
    I have been learning java for some time now(3 months)...I have very good mathematics, solving puzzles & all kind of things...
    I have been excellent in academics and have very good analytical skills...I have nearly photographic memory(My IQ is 187)...
    But developing logic for something that java will understand is like beyond my scope...
    In colleges my friends would tell me that i make them look like chimps...
    But now learning java I feel like i am a chimp...even my friends who struggle doing basic maths and reasoning develop better programs than me...

    My concepts in java are strong because i know what every keyword or method does in java.. but give me a program to write i struggle with what variables to use where.. should i use for-loop or others...

    eg Student exam (off-line) project
    Now i have to put questions(with options) from a notepad file to database & display it on screen using swing...
    I did every functions but I could not develop a logic to make questions from notepad to database to screen...

    I do not expect a solution from you people...but a push in the right direction towards my goal to become a good programmer....H elp me out guys...I have never felt so helpless before....
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    The first step would be to write out in words how you would accomplish this task.

    For example, in this case, one approach would be:

    1) Read one line from the notepad file.
    2) Insert that line into the database.
    3) Display the line to the screen.
    4) Go back to line 1 and repeat until the entire file has been read.

    That is the basic logic.
    Last edited by Rabbit; Feb 11 '13, 04:13 AM.

    Comment

    • Shepard
      New Member
      • Feb 2013
      • 24

      #3
      Thanks a lot Mr.Rabbit...I already got that part... I also attempted using split method by putting symbols at the end of each sentence...But as i said i do not struggle here i struggle in the next step....
      How to put my thinking in codes??

      This thing happens every time...I have a fair idea on how to do the task(java) but not how to put it in codes??
      This is freaking me out.

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        If you're still having problem, you need to write more and more detailed steps until you can translate it to code by mapping functions to the steps.

        For example, step 1 from above can be written in more detail as:
        1a) Open the file
        2a) Read a line from the file

        At this point, I can look for functions that does each of these steps. 1a can be accomplished with the Scanner class and 1b can be accomplished with the nextLine method of the Scanner class.

        And then you tackle the next step. Write more and more specific instructions until you can map them to functions.

        Comment

        Working...