Question: create a sample program of your liking that demonstrates the use of the Math class, and 3 different methods. For example; here is some code
create a sample program of your liking that demonstrates the use of the Math class, and 3 different methods.
For example; here is some code that demonstrates a method, Math.abs()
// the following code will demonstarte the use of the absolute method, in the Math class
int num1 = 4;
int num2 = -9;
System.out.println(("the absolute value of num1 is " + Math.abs(num1))); // this should return (and display) the abs value of num1 System.out.println(("the absolute value of num2 is " + Math.abs(num2))); // this should return (and display) the abs value of num2
You are to write an entire program, name it what you wish, and submit it here. When run, it will demo 3 different methods of the Math class (please do not use the method abs, as I did that one) Don't forget to comment your code and indent properly!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
