For this assignment, you are going to create your own mini-version of the Java Math class.

You will create a class called "MyMath". In it, you will create two public static functions:

  • pow(int a, int b)
  • round(double a)

You will also create a Main class, with a main function. In main(), print to console a couple of lines solving the following equations:

  • What is 2 to the power of 10?
  • What is the value of 4.49 rounded to the nearest whole number?

Side Notes

You MUST use your custom MyMath class to complete these calculations! Do NOT use the in-built Math class. You shouldn't use the original Math class in either Main nor MyMath

You are NOT allowed to create an object of your MyMath class for this assignment! You must use static function calls to your pow() and round() functions.

You can assume that you'll only have to input positive numbers.

You'll need to come up with a formula/solutions for pow() and round() yourself. You may use the following as a starting point for pow:

  • https://www.mathsisfun.com/exponent.html (Links to an external site.) (Links to an external site.)

Output

Example output for your project:

The solution for 2 to the power of 10 is: 1024
The solution for 4.49 rounded to the nearest whole number is: 4.00
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.