Question: Write a program MathOperations.java that will read in command - line argument ( assumed to be a number, and not just an integer ) ,
Write a program MathOperations.java that will read in commandline argument
assumed to be a number, and not just an integer
and
convert the commandline value into a double;
store this value into a variable x;
use x and Math library to output the result of
several mathematical operations, as shown below.
Note on using Math library:
Math.sqrtx returns square root of x
Math.powx returns x raised to the power
Math.absx returns an absolute value of x
Math.cosx returns cosine of x in radians
What should your program print out?
For example, if your commandline value is
your program should output the following:
Your number is
squared
cubed
square root of
raised to the power
The absolute value of
cosine of in radians
Or if your input argument is your program should
output the following:
Your number is
squared
cubed
square root of
raised to the power
The absolute value of
cosine of in radians
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
