Question: We are going to create a calculator program using the math methods from the Math class. Open a new Java class in Eclipse called Maths.java
- We are going to create a calculator program using the math methods from the Math class.
- Open a new Java class in Eclipse called Maths.java
- Create a program that prompts the user to input a number, and then performs calculations on that number.
- Your calculator is going to perform the following operations on that number:
- Raise the number to the power of 2, 3, and 4 (square, cube, quartic)
- Calculate the floor of the number
- Calculate the ceiling of the number
- Calculate the square root of the number
- Calculate the natural log of the number (hint: use the log function)
- Your program should give output as shown below when the user enters 2.5. However, if the user enters another number, the output should change.
- When you are finished, upload your Maths.java file to Canvas.
Your output should look identical to the following (given the same user input):
Enter a number: 2.5
The square of 2.5 is: 6.25
The cube of 2.5 is: 15.625
The quartic (fourth power) of 2.5 is: 39.0625
The ceiling of 2.5 is: 3.0
The floor of 2.5 is: 2.0
The square root of 2.5 is: 1.58114
The natural log of 2.5 is: 0.916291
Step by Step Solution
There are 3 Steps involved in it
Lets walk through creating the Mathsjava program in Eclipse stepbystep Step 1 Create a new Java Project and Class Open Eclipse and create a new Java P... View full answer
Get step-by-step solutions from verified subject matter experts
