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 2 of 2

Thread: Can anyone help get me started?

  1. #1
    Junior Member
    Join Date
    Sep 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Can anyone help get me started?

    Hey guys,

    Basically I need to write a program that takes a users input of addition or subtraction expressions (separated by a ";") and give an answer to them. However, I am confused on how I am supposed to get the actual numbers out of the string of text.

    Clarification
    The program must take a users input of addition or subtraction expressions ending with a ";" then convert the numbers in the string to integers and complete the expression by giving the answer.

    Example
    Welcome to the Expression Calculator
    Enter a line of expressions:
    -5 + 6 - 2 ; 2 – 4– 8; 16 +-18 - -1;
    Expression 1: value = -1
    Expression 2: value = -10
    Expression 3: value = -1

    Requirements
    Your program must give error messages in the following cases:
    o A missing semi-colon on the last expression
    o The use of any operator other than + or -
    o Any deviation from the pattern of “number plus/minus number plus/minus …”
    There is no restriction on the number of spaces


    Thanks a lot guys!


  2. #2
    Forum Squatter newbie's Avatar
    Join Date
    Nov 2010
    Location
    North Wales
    Posts
    661
    My Mood
    Stressed
    Thanks
    28
    Thanked 115 Times in 106 Posts
    Blog Entries
    1

    Default Re: Can anyone help get me started?

    Integer#valueOf(String)

    API is your friend
    Please use [highlight=Java]//code goes here...[/highlight] tags when posting your code

Similar Threads

  1. Just getting started!
    By frogfury in forum What's Wrong With My Code?
    Replies: 1
    Last Post: September 18th, 2010, 12:05 PM
  2. Getting started
    By snakey112 in forum Java Theory & Questions
    Replies: 1
    Last Post: February 2nd, 2010, 06:53 PM
  3. Getting started...
    By Sedsarq in forum Java Theory & Questions
    Replies: 3
    Last Post: November 17th, 2009, 06:46 PM
  4. Can someone help me get started?
    By six in forum The Cafe
    Replies: 4
    Last Post: October 24th, 2009, 01:54 PM
  5. How to get started with Java?
    By Terry in forum The Cafe
    Replies: 4
    Last Post: May 15th, 2009, 04:31 AM

Tags for this Thread