Create a new Java project using your IDE that will include a Java class called MyRoot....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Create a new Java project using your IDE that will include a Java class called MyRoot. Note: you can use the same name for the project name as well. Implement a Java method with the identifier "SquareRoot that takes 1 parameter of type integer and returns a double value that represents the square root of the parameter. Note: you must implement the square root function yourself by using the bisection algorithm as explained in Appendix 1 and you should NOT use any java.lang.Math function. Implement a Java method with the identifier "CubeRoot" that takes 1 parameter of type integer and returns a double value that represents the cube root of the parameter. Note: you must implement the cube root function yourself by using the bisection algorithm as explained in Appendix 1 and you should NOT use any java.lang.Math function. Implement a Java method with the identifier "Root" that takes 2 parameters both of type integer. The first parameter will represent the index of the radical (either 2 or 3) and the second parameter can be any number representing the radicand. The method should check the value of the first parameter and do one of the following actions: - Find and return the square root of the number sent as the second parameter if the first parameter is 2 by calling the method SquareRoot. - Find and return the cube root of the number sent as the second parameter if the first parameter is 3 by calling the method CubeRoot. Implement the hain method that will ask the user to provide 2 integers as input. After taking both values you should do the following: - If the first input value is any number other than 2 or 3 you must provide as output the error message: "Error: you can only calculate square or cube roots". Given the statement S: "If you are a computer science student, then you know either discrete math or Java", which one is logically equivalent to the statement S? You know either discrete math or Java, only if you are a computer science student. Without being a computer science student, you know neither discrete math nor Java. Knowing either discrete math or Java is a necessary condition for you to be a computer science student. You are a computer science student, or you know neither discrete math nor Java, . Create a new Java project using your IDE that will include a Java class called MyRoot. Note: you can use the same name for the project name as well. Implement a Java method with the identifier "SquareRoot that takes 1 parameter of type integer and returns a double value that represents the square root of the parameter. Note: you must implement the square root function yourself by using the bisection algorithm as explained in Appendix 1 and you should NOT use any java.lang.Math function. Implement a Java method with the identifier "CubeRoot" that takes 1 parameter of type integer and returns a double value that represents the cube root of the parameter. Note: you must implement the cube root function yourself by using the bisection algorithm as explained in Appendix 1 and you should NOT use any java.lang.Math function. Implement a Java method with the identifier "Root" that takes 2 parameters both of type integer. The first parameter will represent the index of the radical (either 2 or 3) and the second parameter can be any number representing the radicand. The method should check the value of the first parameter and do one of the following actions: - Find and return the square root of the number sent as the second parameter if the first parameter is 2 by calling the method SquareRoot. - Find and return the cube root of the number sent as the second parameter if the first parameter is 3 by calling the method CubeRoot. Implement the hain method that will ask the user to provide 2 integers as input. After taking both values you should do the following: - If the first input value is any number other than 2 or 3 you must provide as output the error message: "Error: you can only calculate square or cube roots". Create a new Java project using your IDE that will include a Java class called MyRoot. Note: you can use the same name for the project name as well. Implement a Java method with the identifier "SquareRoot that takes 1 parameter of type integer and returns a double value that represents the square root of the parameter. Note: you must implement the square root function yourself by using the bisection algorithm as explained in Appendix 1 and you should NOT use any java.lang.Math function. Implement a Java method with the identifier "CubeRoot" that takes 1 parameter of type integer and returns a double value that represents the cube root of the parameter. Note: you must implement the cube root function yourself by using the bisection algorithm as explained in Appendix 1 and you should NOT use any java.lang.Math function. Implement a Java method with the identifier "Root" that takes 2 parameters both of type integer. The first parameter will represent the index of the radical (either 2 or 3) and the second parameter can be any number representing the radicand. The method should check the value of the first parameter and do one of the following actions: - Find and return the square root of the number sent as the second parameter if the first parameter is 2 by calling the method SquareRoot. - Find and return the cube root of the number sent as the second parameter if the first parameter is 3 by calling the method CubeRoot. Implement the hain method that will ask the user to provide 2 integers as input. After taking both values you should do the following: - If the first input value is any number other than 2 or 3 you must provide as output the error message: "Error: you can only calculate square or cube roots". Given the statement S: "If you are a computer science student, then you know either discrete math or Java", which one is logically equivalent to the statement S? You know either discrete math or Java, only if you are a computer science student. Without being a computer science student, you know neither discrete math nor Java. Knowing either discrete math or Java is a necessary condition for you to be a computer science student. You are a computer science student, or you know neither discrete math nor Java, . Given the statement S: "If you are a computer science student, then you know either discrete math or Java", which one is logically equivalent to the statement S? You know either discrete math or Java, only if you are a computer science student. Without being a computer science student, you know neither discrete math nor Java. Knowing either discrete math or Java is a necessary condition for you to be a computer science student. You are a computer science student, or you know neither discrete math nor Java, .
Expert Answer:
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date:
Students also viewed these programming questions
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
Explain informally the difference between Godel's completeness theorem and his first incompleteness theorem. [8 marks] (b) State the meaning of Hoare triples {P} C {Q} in separation logic. [3 marks]...
-
Data for Barry Computer Co. and its industry averages follow. a. Calculate the indicated ratios for Barry. b. Construct the DuPont equation for both Barry and the industry. c. Outline Barrys...
-
An insurance company samples claim forms for errors created by its employees as well as the amount of time it takes to process a claim. a. When the process is in control, the proportion of claims...
-
What role do collateralized mortgage obligations (CMOs) play in structuring mortgage-backed securities to meet the diverse risk and return preferences of investors, and how do tranche prioritization...
-
If fines for non-compliance are much higher than ever before, how might increased transparency, brought about by environmental accounting disclosures, still act as a competitive advantage to a...
-
Maquina Company produces custom-made machine parts. Maquina recently has implemented an activity-based management (ABM) system with the objective of reducing costs. Maquina has begun analyzing each...
-
Manufacturing cost data for Copa Company are presented below. Indicate the missing amount for each letter (a) through (i). Case A Case B Case C Direct materials used (a) $69,750 $132,700 $ Direct...
-
You have taken out a loan of $19,000 for 4 years with an interest rate of 3% compounded annually. The loan will be repaid by end of year payments. Fill in all the boxes below, and round all entries...
-
Negotiation Puts Hockey In The Penalty Not every negotiation ends on a good note. Just ask National Hockey League (N.H.L.) Commissioner Gary Bettman, who, on February 16, 2005, cancelled all of the...
-
In the year 2019,Country A's real effective exchange rate (REER) showed depreciation over the year 2012 value while the nominal effective exchange rate (NEER) showed an appreciation. In the year...
-
Bandar Industries Berhad of Malaysia manufactures sporting equipment. One of the company's products, a football helmet for the North American market, requires a special plastic. During the quarter...
-
Of the 230,000 units of component TR222 it can produce, Vancouver can sell 184,000 units on the open market at a price of $255 per unit. Kamloops is willing to buy an additional 69,000 units. What...
-
Dameon has been tasked with finding out consumer trends for his new job at a textile company. What is a good first step to his research strategy?
-
Assuming the user enters two positive integers for a and b. The output of this program is a= int(input()) b= int(input()) q=a//b calq 0 while a > b: a-b calq + 1 if calq > q: print("more") elif calq...
-
2 On the SalesData worksheet, in cell F4, create a formula that will perform a calculation that multiplies the Unit Price by the sum of products sold for January, February, and March. If a product...
-
When you weigh yourself on good old terra firma (solid ground), your weight is 142 lb. In an elevator your apparent weight is 121 lb. What are the direction and magnitude of the elevator's...
-
What output will be produced by the following code? public class Demo { public static void main(String[] args) { System.out.println("The output is:"); foo(23); System.out.println(); } public static...
-
Write some code that will use an iterator to interchange the items in every pair of items in an instance of StringLinkedListWithIterator in Listing 12.9. For example, if the list contains "a", "b",...
-
Write a complete program for the problem described in Exercise 10. Exercise 10. Write statements that can be used in a Java program to read two integers and display the number of integers that lie...
-
How are fixed boundary conditions incorporated in the finite element equations?
-
True or False. The system mass matrix is always singular unless the boundary conditions are incorporated.
-
A multiple-leaf spring used in automobiles is shown in Fig. 12.17. It consists of five leaves, each of thickness \(t=0.65 \mathrm{~cm}\) and width \(w=3.8 \mathrm{~cm}\). For the multiple-leaf spring...
Study smarter with the SolutionInn App