Question
In this assignment you are to create a Recursion Class that will implement the following recursive algorithms: Implement Isabels technique for summing the values in
In this assignment you are to create a Recursion Class that will implement the following recursive algorithms:
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 stored in 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.
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
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 calling signature list(path) that reports all entries of the file system rooted at the given path. Note that a path would may look something like: C:\Windows\DigitalLocker. The list of entries should displayed in the console and not in a JOptionPane.
Create a Recursion_Client Class that will fully test each of the recursive methods that you created above in an interactive fashion. This class should:
Use a JOpitonPane to ask the user which algorithm they wish to test.
Use a JOptionPane to ask the user for any parameters/values needed for the test.For Isabels technique the parameter should be the path that contains a blank (white space) separated list of integers values that will make up the array.
When you read in the values from the file you should skip any values that are not integers.
The presence of one or more on-integer values in the input file do not automatically make the file invalid. If the number of valid integer values in the file is a power of 2 then it is a valid input file.
If the input file does not contain a power of 2 number of valid integers your program should inform the user of the problem and ask them to enter a new filename or quit back to the algorithm selection menu.
If the user enters a file that does not exist your program should inform the user that the file does not exist and ask the user to enter a correct filename or quit back to algorithm selection menu.
Output for each test should be shown in the system console and must include:
The name of the algorithm being tested.
The parameters entered by the user
Values used if different from parameters (e.g. the contents of the array read in for Isabels technique).
Error messages give to the user (e.g. file not found)
The results of the test.
Note that the JOptionPane interactions will not be captured in the system console.
At the end of a test the user should be given the options of running another test or exiting the program.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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