Instructions:
- Fork this repository to your GitHub account.
- Clone the forked repository locally to your machine.
- Create a new branch named Feature01.
Objective: Analyze the execution of the loop in the Java program LoopExecAnalysis.java.
- Create a table showing the values of variables i and n during the execution of the loop and add it as markdown below this question, or as an image in this project.
- Determine the output of the program and state it below.
- Discuss if you can prove that this loop terminates for any positive value of n below this question.
Objective: Write a method to approximate the square root of a given number.
- Create a Java file named
src/MySqRoot.javaand implement a method namedsquareRoot(don't use theMath.sqrtmethod) that takes a double parameter "num" and returns an approximation of its square root. - Use the provided formula for the approximation (i.e. each guess of
$x_n$ ), your guess for the square root:$$x_1 = \frac{x_0 + \frac{num}{x_0}}{2}$$ - Hint: This is a loop so
$x_1$ is calculated from$x_0$ and$x_2$ is calculated from$x_1$ , etc. - Hint: An initial guess for the square root (i.e.
$x_0$ ) should be the number you wish to find the square-root for divided by 2.
- Hint: This is a loop so
- Iterate until two consecutive estimates of the squre root (i.e. your
$x_n$ 's differ by less than 0.0001.- Hint: you can use
Math.absto get the absolute value of this difference.
- Hint: you can use
Objective: Determine if a word is abecedarian, which means all the letters in the word occur in alphabetical order.
- Write a method called
isAbecedarian, in the WordChecks.java file, that takes a String and returns a boolean indicating whether the word is abecedarian.
Objective: Check if a word is a "Pair Isogram", meaning every letter in the word occurs twice.
- Write a method called
isPairIsogram, in the WordChecks.java file, that takes a string and checks whether every letter in the word occurs twice. - Ignore case.
One way to evaluate
The ith term in this series is src/InfiniteSeries.java and write a method named gauss that takes x and n as arguments and returns the sum of the first n terms of the series. You should try NOT to write/use the factorial or Math.pow methods respectively.
Follow these steps for submission:
- Create a Feature01 branch of your code if you haven't already.
- Commit your working code for the exercises to your local copy/Feature01 branch.
- Push it to your Remote/origin branch (i.e., GitHub: Feature01 -> origin/Feature01).
- Issue a Pull request to my instructor repo.
- Make sure to COPY the Pull request URL and submit it for the lab/assignment in Canvas.