Question

In: Computer Science

In java. Determine the value of each of the following expressions. (Format your answer with two...

In java. Determine the value of each of the following expressions. (Format your answer with two decimal places.) a. Math.abs(-4) b. Math.abs(10.8) c. Math.abs(-2.5) d. Math.pow(3.2, 2) e. Math.pow(2.5, 3) f. Math.sqrt(25.0) g. Math.sqrt(6.25) h. Math.pow(3.0, 4.0) / Math.abs(-9) i. Math.floor(28.95) j. Math.ceil(35.2)

Solutions

Expert Solution

Source Code:

import java.lang.Math;
class ex
{
   public static void main(String[] args) {
       System.out.printf("Math.abs(-4)=%d\n",Math.abs(-4));
       System.out.printf("Math.abs(10.8)=%.2f\n",Math.abs(10.8));
       System.out.printf("Math.abs(-2.5)=%.2f\n",Math.abs(-2.5));
       System.out.printf("Math.pow(3.2, 2=%.2f\n",Math.pow(3.2,2));
       System.out.printf("Math.pow(2.5, 3)=%.2f\n",Math.pow(2.5,3));
       System.out.printf("Math.sqrt(25.0)=%.2f\n",Math.sqrt(25.0));
       System.out.printf("Math.sqrt(6.25)=%.2f\n",Math.sqrt(6.25));
       System.out.printf("Math.pow(3.0, 4.0)/Math.abs(-9)=%.2f\n",Math.pow(3.0,4.0)/Math.abs(-9));
       System.out.printf("Math.floor(28.95)=%.2f\n",Math.floor(28.95));
       System.out.printf("Math.ceil(35.2)=%.2f\n",Math.ceil(35.2));
   }
}

Sample input and output:


Related Solutions

Determine the value, true or false, of each of the following Boolean expressions, assuming that the...
Determine the value, true or false, of each of the following Boolean expressions, assuming that the value of the variable count is 0 and the value of the variable limit is 10. Give your answer as one of the values true or false. a. (count == 0) && (limit < 20) b. count == 0 && limit < 20 c. (limit > 20) || (count < 5) d. !(count == 12) e. (count == 1) && (x < y) f....
java code Question 2: What are the type and value of each of the expressions below?...
java code Question 2: What are the type and value of each of the expressions below? int [] numbers = { 3, 6, 15, 22, 100, 0 }; double [] decimals = { 3.5, 4.5, 2.0, 2.0, 2.0 }; String [] words = {"alpha", "beta", "gamma"}; numbers[3] + numbers[2] decimals[2] - decimals[0] + numbers[4] words[1].charAt( numbers [0] ) numbers[4] * decimals[1] <= numbers[5] * numbers[0]
Determine the p-value for each of the following situations. (Give your answer bounds exactly.) (a) Ha:...
Determine the p-value for each of the following situations. (Give your answer bounds exactly.) (a) Ha: β1 > 0, with n = 15 and t = 1.23 _____ < p < _____ (b) Ha: β1 ≠ 0, with n = 25, b1 = 0.3, and sb1 = 0.11 ____ < p < _____ (c) Ha: β1 < 0, with n = 18, b1 = -1.55, and sb1 = 0.73 ____< p < ____
1) Determine the answer to each of the following questions. 1a. Find the Future Value of...
1) Determine the answer to each of the following questions. 1a. Find the Future Value of $2500 invested today at 11% for 10 years. 1b. Find the Future Value of $2500 invested today at 11% for 30 years. 1c. Find the Present Value of $6000 received 10 years from today if the discount rate is 5%. 1d. Find the Present Value of $6000 received 10 years from today if the discount rate is 10%. 1e. Find the Future Value of...
a)The term value has various meaning and expressions. Discuss the following expressions of value i.Fair Market...
a)The term value has various meaning and expressions. Discuss the following expressions of value i.Fair Market Value ii.Intrinsic value iii.Going concrn valuee iv.Book value b)Explain the concept of ‘Efficient Capital Market’ stating its relevance in valuation c)List and discuss five factors which should be considered when valuing a corporation d)List and discuss four characteristics or features of a good or better valuation exercise
Determine whether each of the following statements is true or false. Justify your answer for any...
Determine whether each of the following statements is true or false. Justify your answer for any that you think are false. a) The margin of error for a 95% confidence interval for the population proportion p increases as the sample size increases. b) The margin of error for a confidence interval for the population proportion p, based on a specified sample size n, increases as the confidence level decreases . c) The margin of error for a 95% confidence interval...
Determine whether each of the following is an internal control strength or weakness. Explain your answer....
Determine whether each of the following is an internal control strength or weakness. Explain your answer. 1. Receiving department manager places an order with the vendor for merchandise inventory. 2. A voucher is used to certify a transaction and authorize recording of the liability. 3. Goods are received by the receiving department and documented with a receiving report. 4. Accounting department pays the vendor's invoice before goods are received. 5. Invoices are paid after completion of the invoice approval documenting...
Determine the t critical value for a two-sided confidence interval in each of the following situations.
 Determine the t critical value for a two-sided confidence interval in each of the following situations. (Round your answers to three decimal places.) (a) Confidence level = 95%, df = 5 (b) Confidence level = 95%, df = 10 (c) Confidence level = 99%, df = 10 (d) Confidence level = 99%, n = 10 (e) Confidence level = 98%, df = 22 (f) Confidence level = 99%, n = 36 You may need to use the appropriate table in the Appendix of Tables to answer this...
1)Determine the pH of each solution. Part A 0.20 M KCHO2 Express your answer to two...
1)Determine the pH of each solution. Part A 0.20 M KCHO2 Express your answer to two decimal places. Part B 0.21 M CH3NH3I Express your answer to two decimal places. Part C 0.22 M KI Express your answer to two decimal places. 2) Part A Rank the following compounds in order of decreasing acid strength using periodic trends. Rank the acids from strongest to weakest. To rank items as equivalent, overlap them. LiH, H2O, HCl, HBr
Part II: For the following questions, provide your response in short-answer format (3–5 sentences each). Use...
Part II: For the following questions, provide your response in short-answer format (3–5 sentences each). Use this Phase’s activities and resources to assist you in answering. 1.           How does the vegetation surface type affect the amount of runoff? Speculate why this happens. 2.           How does the smooth mountain rock surface type affect the amount of runoff? Speculate why this happens. 3.           How does the bare soil surface type affect the amount of runoff? Speculate why this happens. 4.           How does...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT