Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Help for Implementing Hexadecimal Calculator !

807603Oct 27 2007 — edited Oct 27 2007
Hi Friends!
I am writing a program to implement a console based calculator which will perform some basic arithmatic operation.
It will provide two mode i.e. Decimal mode and hexadecimal mode.
Since my project require polymorphism, i have to use same function name for both Decimal as well as hexadecimal.
I wrote a code for decimal calculator. but cant find solution how to implement these same function for hexadecimal.

here is my function list for decimal calculator:
//Calculate the Addition of two numbers
  public double add(double numAdd1, double numAdd2){
    return numAdd1 + numAdd2;
  }
//Calculate the subtraction of two numbers
  public double sub(double numSub1, double numSub2){
    return numSub1 - numSub2;
  }
//Calculate the multiplication of two numbers
  public double multiply(double numMul1, double numMul2){
    return numMul1 + numMul2;
  }
//Calculate the Division of two numbers
  public double divide(double numDiv1, double numDiv2){
    return numDiv1 / numDiv2;
  }
//Calculate the Square of a numbers
  public double square(double numSqr1){
    return numSqr1*numSqr1;
  }
//Calculate the Cube of a numbers
  public double cube(double numCube1){
    return numCube1 * numCube1 * numCube1;
  }
//Calculate the SQUARE-ROOT of a numbers
  public double squareRoot(double numSqrt1){
    return Math.sqrt(numSqrt1);
  }
//Calculate the power of numbers
  public double power(double numpow1, double numPow2){
    return Math.pow(numPow1,numPow2);
  }
I want to used these same function names for hexadecimal arithmatic calculations (polymorphism).

Please provide some help regarding this!

Thanks In Advanced

Edited by: rushikesh on Oct 27, 2007 5:44 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 24 2007
Added on Oct 27 2007
6 comments
309 views