Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: complex input parsing

  1. #1
    Junior Member
    Join Date
    Aug 2013
    Posts
    17
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default complex input parsing

    Hello everyone!

    I have a problem where i don't know how to start.
    As a java beginner i'm lacking knowledge how to best achieve what i intend to to.

    What i intend to do:
    writing some calculator-like thing but not like the simple ones where you press your buttons for 0-9 plus buttons for certain operations like + ,- and so on.
    What i want is a textfield where you can input things like 2 + 2.32 + (double) 1 - 2.34434f and get the result plus the data type this would have in java.
    So what i want to create is like a small training programm where people (including myself ) can input java expressions and test their understanding of casting and automatic type conversion. In this way i can learn something about how to work with input and about javas mechanics at the same time.

    Is there any efficient and understandable way a beginner could do this?
    Thanks in advance for any advice and help!


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    3,408
    My Mood
    Mellow
    Thanks
    83
    Thanked 473 Times in 464 Posts

    Default Re: complex input parsing

    There is no way to pour into your head while you sleep the knowledge and skills needed to accomplish what you've described. It's a reasonable project (though I find the idea of specifying the data type annoying - the calculator should just deal with whatever is entered) but somewhat advanced for someone without much Java experience and little/no GUI experience. But you have to start somewhere.

    I recommend you start with the Java Tutorials, ignoring the parts about using the Netbeans GUI Builder.

  3. #3
    Junior Member
    Join Date
    Aug 2013
    Posts
    17
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Re: complex input parsing

    O_o...i asked in a proper manner..i don't know why i deserve such harsh words.

    and what is annoying about the idea of specifying the data type? i personally would find that usefull...

  4. #4
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    3,408
    My Mood
    Mellow
    Thanks
    83
    Thanked 473 Times in 464 Posts

    Default Re: complex input parsing

    There was no intent to be harsh, and I apologize if I overstated my point, which was:

    There are no short cuts or guaranteed efficient ways to learning a programming language and becoming proficient and skillful at it. Further, jumping straight to GUI programming without a solid foundation of understanding and experience in programming basics is usually a mistake. If you're already aware of programming basics in another strongly-typed, object-oriented language, including data types, variables, branching, looping, methods/function/subroutines, objects and classes, and arrays, then you should be able to pick up GUI programming in Java using the link I provided above. If you're completely new to programming, then you should spend a few weeks or months studying those topics I listed, writing several examples and exercise programs on each topic. Here's a good, free online book that I recommend to get started. There are links to others I can provide, if you don't find this one understandable. The Java Tutorials is also a good place to start.

    As for a calculator where the user specifies the data type, we can each have our own thoughts on that, and I am not trying to change yours. However, I would suggest that the calculator interface include the ability to specify the data type in some way other than typing it. A graphical interface, should require as little use of the keyboard as possible.

    Good luck, and please come back when you need help!

  5. #5
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 262 Times in 231 Posts

    Default Re: complex input parsing

    Quote Originally Posted by Wolfone View Post
    I have a problem where i don't know how to start.
    ...What i want is a textfield where you can input things
    Start there

  6. #6
    Junior Member
    Join Date
    Aug 2013
    Posts
    17
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Re: complex input parsing

    ok i c...maybe i overreacted. and yes i have way more theoretical knowledge than practical. as a mathematician i did a lot of programming in matlab and algorithms, loops, branches and so an are not the problem. maybe i want too much for now...

    i am aware of the fact that i may be doing things at the moment which aren't necessarily done that way. i don't know. i do it this way to learn something about this specific language and how it works. so first i did was playing around with classes and inheritance, learning how constructors work, how to overload, and so on...doing a little bit of GUI to see if my expectations are met.
    well...i will start as jps said with a textfield that shouldn't be the bigger problem. maybe something that manipulates a string and gives back the manipulated string.
    started reading the GUI tutorial ^^

    thanks you 2

Similar Threads

  1. Complex Numbers in Java
    By JavaNovice03355 in forum Member Introductions
    Replies: 1
    Last Post: May 18th, 2011, 07:30 PM
  2. Parsing a string to an int while receiving user input?
    By happyxcrab in forum What's Wrong With My Code?
    Replies: 4
    Last Post: May 11th, 2011, 05:38 PM
  3. Parsing many Ints from a user input String.
    By helpmeplease111 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: May 7th, 2011, 08:41 PM
  4. Parsing input based on grammar rules
    By Winterfresh in forum Algorithms & Recursion
    Replies: 1
    Last Post: March 11th, 2010, 06:54 PM
  5. Input file parsing to insert into DB
    By IDForums in forum File I/O & Other I/O Streams
    Replies: 3
    Last Post: September 30th, 2009, 02:29 AM