Allan Didier



Write a Java program the can do more complex math calculations.


  • Casting variables
  • Modulus and remainder
  • Output with Strings and numbers
  • Math library

Program Details

Your program needs to

  1. Prompt the user to enter two integers, x and y.
  2. Calculate and print the following:
    1. The decimal equivalent of the fraction x / y.
    2. The quotient plus the remainder of the fraction x / y.
    3. The absolute value of x – y
    4. The exponential x raised to the y power. 
    5. The square root of x times y. 
  3. Make sure to test with numbers that will generate whole-number and decimal fractions (i.e. 4 /2 = 2.0 and 5 / 2 = 2.5), negative numbers, and zero as the denominator. 


  • Page 86-87 Conversion Techniques
  • Cast one of the integers as a floating point number.


Edhesive Term 1

Lesson 6: Casting Variables

Lesson 7: Remainder and Modulus

Lesson 8: Output Strings and Numbers

Lesson 9: Import Math Class

Lesson 10:  Roundoff Error