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

Thread: Calculator in eclipse

  1. #1
    Junior Member
    Join Date
    Nov 2013
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Calculator in eclipse

    i need help for the code of the memory buttons(M+, M-, Mr and Mc). someone help me pleasee


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Calculator in eclipse

    Show us your code, and we'll help if we can. And why do you need help with the memory buttons. Memory is a variable. You add to the variable, subtract from the variable, get the value of the variable, or set the value of the variable to zero. Pretty darned simple.

    That you're using Eclipse as your IDE is irrelevant. That you're programming in Java is all that matters.

  3. The Following User Says Thank You to GregBrannon For This Useful Post:

    oltaA (November 23rd, 2013)

  4. #3
    Junior Member
    Join Date
    Nov 2013
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Calculator in eclipse

    JButton btn_Mm = new JButton("M-");
    btn_Mm.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    here i have 2 write what ???

    }

  5. #4
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Calculator in eclipse

    here i have 2 write what ???
    calculator.subtractFromMemory( calculator.getUserInput() );

    Of course I've made up names for variables and methods, but the gist of it is that the code in that action listener subtracts the user's input from an existing variable in which the current value of the calculator's memory is stored.

  6. #5
    Junior Member
    Join Date
    Nov 2013
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Calculator in eclipse

    eemm... can you help me with a tutorial

  7. #6
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Calculator in eclipse

    No, though there are several calculator tutorials on the Internet. If you've written the rest of the calculator or developed the code you have from other tutorials, this part is trivial, IF you understand what you've done so far. If you don't, I can't help you.

  8. #7
    Junior Member
    Join Date
    Nov 2013
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Calculator in eclipse

    yes i know what i have done, but im having problems with the memory button,,, i have problems with the language and i cant explain you well the problem, whatever... thanks for the reply!

Similar Threads

  1. Replies: 24
    Last Post: August 4th, 2014, 12:49 PM
  2. Replies: 4
    Last Post: October 3rd, 2013, 05:25 PM
  3. Replies: 2
    Last Post: September 25th, 2013, 03:35 PM
  4. Replies: 1
    Last Post: October 20th, 2012, 12:21 PM