What values will print? Use Eclipse to verify it but only after you write down youranswers based on your understanding.Submission• Only write the answerdouble x = Math.sqrt(4);System.out.println(x);x = Math.sqrt(-9);System.out.println(x);x = Math.pow(4,3);System.out.println(x);x = Math.pow(3,4);System.out.println(x);x = Math.ceil(2.4);System.out.println(x);x = Math.floor(2.9);System.out.println(x);x = Math.ceil(-3.7);System.out.println(x);x = Math.floor(-3.7);System.out.println(x);x = Math.round(2.4);System.out.println(x);x = Math.round(2.9);System.out.println(x);x = Math.round(-3.7);System.out.println(x);x = Math.rint(2.4);System.out.println(x);x = Math.rint(2.9);System.out.println(x);x = Math.round(3.5);System.out.println(x);x = Math.round(-3.5);System.out.println(x);x = Math.rint(3.5);System.out.println(x);x = Math.rint(-3.5);System.out.println(x);

Question
Asked Feb 26, 2019
11 views

What values will print? Use Eclipse to verify it but only after you write down your
answers based on your understanding.
Submission
• Only write the answer
double x = Math.sqrt(4);
System.out.println(x);
x = Math.sqrt(-9);
System.out.println(x);
x = Math.pow(4,3);
System.out.println(x);
x = Math.pow(3,4);
System.out.println(x);
x = Math.ceil(2.4);
System.out.println(x);
x = Math.floor(2.9);
System.out.println(x);
x = Math.ceil(-3.7);
System.out.println(x);
x = Math.floor(-3.7);
System.out.println(x);
x = Math.round(2.4);
System.out.println(x);
x = Math.round(2.9);
System.out.println(x);
x = Math.round(-3.7);
System.out.println(x);
x = Math.rint(2.4);
System.out.println(x);
x = Math.rint(2.9);
System.out.println(x);
x = Math.round(3.5);
System.out.println(x);
x = Math.round(-3.5);
System.out.println(x);
x = Math.rint(3.5);
System.out.println(x);
x = Math.rint(-3.5);
System.out.println(x);

check_circle

Expert Answer

Step 1

Description of the Java Math utilities used:-

Math.sqrt() returns the square root of its paramter a double value.
Math.sqrt() expects a postive number as a parameter. It the parameter is negative is returns NaN.
Math.pow() raises the first paramter to the power of the second paramter.
Math.ceil() returns the smallest double value which is greater than or equal to the paramter.
Math.floor() returns the largest double value which is lesser than or equal to the paramt...

Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in

Engineering

Computer Science

Related Computer Science Q&A

Find answers to questions asked by student like you
Show more Q&A
add
question_answer

Q: Write a program in Eclipse that prompts the user for first name, last name, then secret number. The ...

A: Program plan:Include the required header file.Define the class “Main”.Define the “defaultInfo” metho...

question_answer

Q: Problem: Create a base class called Vehicle that has the manufacturer’s name (typeString), number of...

A: Program plan:Create a class called “Person” with required constructors and methods.Create a class ca...

question_answer

Q: I am struggling on storing numbers from the getChoice () function into an array and pulling it back ...

A: Click to see the answer

question_answer

Q: • Write a program in Eclipse that computes future investment value at a given interest rate for a sp...

A: Program plan:Import necessary packages.Define a class named “Investment”.Define a method named “comp...

question_answer

Q: Is the following distributive law valid or invalid? Prove your answer. x XOR (y + z) = (x XOR y) + ...

A: Answer:Here, the truth table is used to get the answer for each side of the question.First take LHS,

question_answer

Q: The speed of computers has increased greatly over the history of computing. The traveling salesman p...

A: TSP is an NH Hard problem, if solved by brute force method it takes (n-1)! time where n is the size ...

question_answer

Q: You are not required to execute the queries. However, your syntax must by accurate.You must give at ...

A: 8.SELECT MOVIE_TITLE, MOVIE_YEAR, PRICE, PRICE_RENTAL_FEE FROM MOVIES WHERE MOVIE_CATEGORY = 'FAMILY...

question_answer

Q: Problem: Create a base class called Vehicle that has the manufacturer’s name (typeString), number of...

A: 4 classes are implemented using the blueprint given:Vehicle class which is the base class is: public...

question_answer

Q: My assignment wants me to program the hailstone series. I have done that, but my program isn't execu...

A: To input integer value into a string you need to use stringstream class which is declared in sstream...