Question
Create a Recursion Class that will implement the following recursive algorithms: Implement a recursive algorithm to compute the n th Harmonic number defined as: H
Create a Recursion Class that will implement the following recursive algorithms:
- Implement a recursive algorithm to compute the nth Harmonic number defined as:
Hn=k=1n1k
-
- where k is a natural number, i.e. an integer greater than 0.
- The user needs to enter the value for n.
- Your program should check to insure that the value entered by the user is an integer greater than 0.
- If the user enters an invalid value for n then it should display an error message and ask the user if they want to try again.
- Implement Isabels technique for summing the values in an array of n integers as described in problem C-5.24 on page 223 of the textbook.
- The values to be summed by Isabels technique should be read from an ASCII text file. You can create this file using a text editor like Notepad.
- The values should be white space delimited in this file where white space includes spaces, tabs, and newlines.
- To call to Isabels technique your program needs to:
- Request the path to the data file
- Load the contents of the data file into an array
- Call Isabels technique
- Your program should check each token that is read from the file and skip any tokens that are not valid integers.
- As described in the text, Isabels technique only works for arrays that contain a power of 2 number of integers. If the number of integers in the data file are not a power of 2 your method must throw an appropriate exception.
- Implement a recursive method with the signature
void find( String filename, String startPath )
that finds and prints all entries of the files named filename starting at the given path. Note that a path would may look something like C:\Windows\DigitalLocker.
- If the user enters an invalid path your program should generate an appropriate error message and ask the user if they want to try again.
Create a Client Class that will fully test each of the recursive methods that you created above in an interactive menu fashion. This class should:
- Use a JOpitonPane to ask the user which algorithm they wish to test.
- The user should be provided with a menu/list to select from
- If the user selects an invalid option, the program should
- Inform the user of their mistake and allow them to try again
- The last option in the menu/list should allow the user to quit the program.
For each recursive technique, use a JOptionPane to ask the user for any parameters/values needed for the test.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started