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

Thread: Performing operations without using ARithmetic Operators

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

    Unhappy Performing operations without using ARithmetic Operators

    Guys!
    Please help me I have this lab exercise and I really dont know what to do.. Im desperate
    My professor posted this:
    Objectives:
    - To let the participants experience the use of loops and operators.

    Create a Java Application using the class BasicMathOperation. The application will initialize two integer values and display the ff:
    a. Product without using the multiplication (‘*’) operator.
    b. Integer quotient without using the division (‘/’) operator.
    c. Integer remainder without using the modulo (‘%’) operator.
    d. Take note that inside the whole code, you are NOT allowed to use the ff: operators: ‘*’, ‘/’, and ‘%’.

    Save your file as ICS112_Section_Exercise3_Surname_ComputerNumber.ja va (ie: ICS112_1ITB_Beltran_25.java)

    Class BasicMathOperation UML Diagram
    BasicMathOperation
    - operand1 : int
    - operand2 : int
    //constructor
    + BasicMathOperation(int num1, int num2)
    //setters
    + setOperand1(int num1) : void
    + setOperand2(int num2) : void
    //getters
    + getOperand1() : int
    + getOperand2() : int
    //basic methods
    + multiplyUsingLoop() : int
    + divideUsingLoop() : int
    + moduloUsingLoop() : int
    Note: To avoid division by zero, the operand2 must have no value of zero. Same is true to modulo by zero, that is, the operand2 must have no value of zero. And this condition must be checked in the methods divideUsingLoop() and moduloUsingLoop(). If this happen, the output is “Error division by zero” or “Error modulo of zero”, respectively. And the program exit using the command System.exit(1).


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

    Default Re: Performing operations without using ARithmetic Operators

    Harness that desperation and make an effort to understand the assignment, formulate a design, and write some code. We can't help you with code, but I can suggest that you work the problem one piece at a time and work it through, breaking it into even smaller, more manageable pieces, if necessary. When you have some code that you need help with, please come back. Post code and any errors you want help with, code posted in code tags.

    Good luck!

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

    Default Re: Performing operations without using ARithmetic Operators

    Thank you thank you I'll do that.

    --- Update ---

    I dont know how to start.. Im just a beginner and Ive been searching about this topic for how many hours. My professor didnt taught us how to do this. He just posted this. Help help help

Similar Threads

  1. Replies: 4
    Last Post: April 13th, 2013, 02:40 AM
  2. java: performing modification in file.
    By basha2013 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: January 8th, 2013, 11:41 PM
  3. [SOLVED] Performing Division with Double Variables
    By bgroenks96 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: June 5th, 2011, 05:36 PM
  4. my FileReader(i think) isn't performing properly..
    By weej25aya in forum What's Wrong With My Code?
    Replies: 0
    Last Post: March 21st, 2011, 10:06 PM
  5. Arithmetic’s Game ??
    By holy crab in forum Algorithms & Recursion
    Replies: 0
    Last Post: April 12th, 2010, 04:27 AM