Addition program

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kakarla Durga Prasad
    New Member
    • Sep 2007
    • 3

    #1

    Addition program

    i want Java program for additin of two numbers with out using any Arithemetic operator.
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by Kakarla Durga Prasad
    i want Java program for additin of two numbers with out using any Arithemetic operator.
    We can't help you cheat by doing your homework for you.

    Comment

    • JosAH
      Recognized Expert MVP
      • Mar 2007
      • 11453

      #3
      Originally posted by Kakarla Durga Prasad
      i want Java program for additin of two numbers with out using any Arithemetic operator.
      Why do you want such a program; I mean it will be highly inefficient compared
      to a simple '+' operator.

      kind regards,

      Jos

      Comment

      • r035198x
        MVP
        • Sep 2006
        • 13225

        #4
        Originally posted by JosAH
        Why do you want such a program; I mean it will be highly inefficient compared
        to a simple '+' operator.

        kind regards,

        Jos

        And the program doesn't even teach as much Java as you would want your students to learn from an assignment if you were a teacher.

        Comment

        • JosAH
          Recognized Expert MVP
          • Mar 2007
          • 11453

          #5
          Originally posted by r035198x
          And the program doesn't even teach as much Java as you would want your students to learn from an assignment if you were a teacher.
          True, teachers either like to freak with bits or they come up with assignments
          using Swing components before the students can even design a couple of decent
          classes. Or the ever boring CD inventory program of course ;-)

          kind regards,

          Jos

          Comment

          • Ganon11
            Recognized Expert Specialist
            • Oct 2006
            • 3651

            #6
            Originally posted by JosAH
            True, teachers either like to freak with bits or they come up with assignments
            using Swing components before the students can even design a couple of decent
            classes. Or the ever boring CD inventory program of course ;-)

            kind regards,

            Jos
            Don't forget Rational numbers.

            I have a feeling that if I take a Java class here at college, I'll come across the same problem.

            Comment

            • Nepomuk
              Recognized Expert Specialist
              • Aug 2007
              • 3111

              #7
              Originally posted by Ganon11
              Don't forget Rational numbers.

              I have a feeling that if I take a Java class here at college, I'll come across the same problem.
              If you want to add rational (or real or even complex) numbers, you must still use the '+' operator or an alternative, which is capable of adding integers / doubles. Just have to write a bit more code.

              There's a wonderful quote: "God created the positive integers. Everything else was created by man."

              Greetings,
              Nepomuk

              Comment

              • JosAH
                Recognized Expert MVP
                • Mar 2007
                • 11453

                #8
                Originally posted by nepomuk
                There's a wonderful quote: "God created the positive integers. Everything else was created by man."
                I like the following corollary: "zero, one, more". Where 'more' may include
                integral numbers, rational numbers, real (IEE) numbers, complex numbers,
                quaternions and even the number three.

                kind regards,

                Jos ;-)

                Comment

                • Nepomuk
                  Recognized Expert Specialist
                  • Aug 2007
                  • 3111

                  #9
                  Originally posted by JosAH
                  I like the following corollary: "zero, one, more". Where 'more' may include
                  integral numbers, rational numbers, real (IEE) numbers, complex numbers,
                  quaternions and even the number three.

                  kind regards,

                  Jos ;-)
                  Well, zeros and ones are certainly anything a computer (and a mathematician, who goes back to the basics) needs... ^^

                  Greetings,
                  Nepomuk

                  Comment

                  • JosAH
                    Recognized Expert MVP
                    • Mar 2007
                    • 11453

                    #10
                    Originally posted by nepomuk
                    Well, zeros and ones are certainly anything a computer (and a mathematician, who goes back to the basics) needs... ^^

                    Greetings,
                    Nepomuk
                    Duh, you CS guys always overcomplicate things; us math type of folks only
                    need an idempotent element and a successor function.

                    kind regards,

                    Jos ;-)

                    Comment

                    • r035198x
                      MVP
                      • Sep 2006
                      • 13225

                      #11
                      Originally posted by JosAH
                      Duh, you CS guys always overcomplicate things; us math type of folks only
                      need an idempotent element and a successor function.

                      kind regards,

                      Jos ;-)
                      And a few ridiculous axioms ...

                      Comment

                      • Nepomuk
                        Recognized Expert Specialist
                        • Aug 2007
                        • 3111

                        #12
                        Originally posted by JosAH
                        Duh, you CS guys always overcomplicate things; us math type of folks only
                        need an idempotent element and a successor function.

                        kind regards,

                        Jos ;-)
                        Well, actually I'm also a math guy, but you will need neutral elements (0 and 1 ARE idempotent elements by the way, at least within the complex numbers and any subset of those) and, as r035198x pointed out, a few axioms. Just imagine, you couldn't expect "a + b = b + a"! (And yes, I do know, that you get such constructs, but they aren't much use in anything the OP might want to do, are they?)

                        Greetings,
                        Nepomuk

                        Comment

                        • JosAH
                          Recognized Expert MVP
                          • Mar 2007
                          • 11453

                          #13
                          Originally posted by nepomuk
                          Well, actually I'm also a math guy, but you will need neutral elements (0 and 1 ARE idempotent elements by the way, at least within the complex numbers and any subset of those) and, as r035198x pointed out, a few axioms. Just imagine, you couldn't expect "a + b = b + a"! (And yes, I do know, that you get such constructs, but they aren't much use in anything the OP might want to do, are they?)

                          Greetings,
                          Nepomuk
                          Quick! Defenestrate this man! He's overcomplicatin g things again by
                          re-rejargoning simple things! Help! Help! I'm being oppressed! Help!

                          kind regards,

                          Jos ;-)

                          Comment

                          • Nepomuk
                            Recognized Expert Specialist
                            • Aug 2007
                            • 3111

                            #14
                            Originally posted by JosAH
                            Quick! Defenestrate this man! He's overcomplicatin g things again by
                            re-rejargoning simple things! Help! Help! I'm being oppressed! Help!

                            kind regards,

                            Jos ;-)
                            I'm not overcomplicatin g things, I'm just going back to the basics.

                            But hey, I managed to oppress JosAH? Wow, that makes me feel really good! ;-)

                            Feeling very much defenestrated,
                            Nepomuk

                            Comment

                            Working...