Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

10 Minute Guide To Accounting For Non Accountants

Authors: Wayne A. Label

1st Edition

0028614070, 978-0028614076

Students also viewed these Databases questions

Question

Explain the various techniques of Management Development.

Answered: 1 week ago