Write a Java program the can do more complex math calculations.
- Casting variables
- Modulus and remainder
- Output with Strings and numbers
- Math library
Your program needs to
- Prompt the user to enter two integers, x and y.
- Calculate and print the following:
- The decimal equivalent of the fraction x / y.
- The quotient and the remainder of the fraction x / y. For example if x = 50 and y = 7, your program should report that 50 / 7 is 7 with a remainder of 1 (or 7 + 1/7).
- The absolute value of x – y
- The exponential x raised to the y power.
- The square root of x times y.
- 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
Bill Barnum’s AP Computer Science A test prep videos