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);

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...

Tagged in

Find answers to questions asked by student like you

Show more Q&A

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...

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...

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

A: Click to see the 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...

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,

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 ...

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...

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...

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...