1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ELEN [110]
3 years ago
10

Build a class and a driver for use in searching your computer’s secondary storage (hard disk or flash memory) for a specific f

ile from a set of files indicated by a starting path. Lets start by looking at a directory listing. Note that every element is either a file or a directory.
Introduction and Driver
In this assignment, your job is to write a class that searches through a file hierarchy (a tree) for a specified file. Your FindFile class will search a directory (and all subdirectories) for a target file name.
For example, in the file hierarchy pictured above, the file "lesson.css" will be found once in a directory near the root or top-level drive name (e.g. "C:\") . Your FindFile class will start at the path indicated and will search each directory and subdirectory looking for a file match. Consider the following code that could help you build your Driver.java:
String targetFile = "lesson.css";
String pathToSearch ="
C:\\WCWC"; FindFile finder = new FindFile(MAX_NUMBER_OF_FILES_TO_FIND);
Finder.directorySearch(targetFile, pathToSearch);
File Searching
In general, searching can take multiple forms depending on the structure and order of the set to search. If we can make promises about the data (this data is sorted, or deltas vary by no more than 10, etc.), then we can leverage those constraints to perform a more efficient search. Files in a file system are exposed to clients of the operating system and can be organized by filename, file creation date, size, and a number of other properties. We’ll just be interested in the file names here, and we’ll want perform a brute force (i.e., sequential) search of these files looking for a specific file. The way in which we’ll get file information from the operating system will involve no ordering; as a result, a linear search is the best we can do. We’d like to search for a target file given a specified path and return the location of the file, if found. You should sketch out this logic linearly before attempting to tackle it recursively.
FindFile Class Interface
FindFile(int maxFiles): This constructor accepts the maximum number of files to find.
void directorySearch(String target, String dirName): The parameters are the target file name to look for and the directory to start in.
int getCount(): This accessor returns the number of matching files found
String[] getFiles(): This getter returns the array of file locations, up to maxFiles in size.
Requirements
Your program should be recursive.
You should build and submit at least two files: FindFile.java and Driver.java.
Throw an exception (IllegalArgumentException) if the path passed in as the starting directory is not a valid directory.
Throw an exception if you've found the MAX_NUMBER_OF_FILES_TO_FIND and catch and handle this in your main driver. Your program shouldn't crash but rather exit gracefully in the unusual situation that we've discovered the maximum number of files we were interested in, reporting each of the paths where the target files were found.
The only structures you can use in this assignment are basic arrays and your Stack, Queue, or ArrayList from the previous homeworks. Do not use built-in data structures like Java's ArrayList. To accomplish this, put in the following constructor and method to your ArrayList, Stack, or Queue:
public ArrayList(Object[] input) { data = input;
numElements = input.length;
}
public Object get(int index) {
return data[index];
}
Computers and Technology
1 answer:
777dan777 [17]3 years ago
6 0

Answer:

hxjdbjebjdbdubainsinnsubd jdn dkdjddkndjbdubdb su djsbsijdnudb djdbdujd udbdj. djdjdjidndubdu dubdjdbdinndjndidn s dj dudbdjubd dujdjjdjdb djdbdjd udbdudb jndjdbudbdue idbd dudbid d dujejdunebudbdjdj d

You might be interested in
You need to put cabling for connecting two new computers in a room, which did not have any network infrastructure. Because of th
vredina [299]

Answer: Twisted pair cabling in the shielded form can be used for the mentioned situation in the question

Explanation: Twisted pair cables in shielded form are easy to make a connection .It does not create lot of noise and has reduced cross talk .It is a low weighted cable and so it can be easily attached with the ceiling tile.

The maintenance of the complete cabling is not a issue and interference is also low that fulfills the requirement of disruption-less network signal.The overall costing of the cable is also less .Thus shielded twisted pair cable are the most appropriate cable for the mentioned situation.

3 0
3 years ago
Read 2 more answers
A brown outline around a frame is an indication of which tool?​
zimovet [89]

Answer:

Direct Selection Tool

Explanation:

The Direct Selection tool is a tool that allows the selection of a single object or a single path such that an object already grouped with other objects can be directly and moved to a desired location

The Direct Selection tool can be used to select a container's content including graphics which are imported and specific points or paths of a figure or text to allow for drawing, text editing or to edit paths.

6 0
3 years ago
________ are a kind of middleware software that provides the glue connecting traditional corporate systems to the customer as we
GalinKa [24]

Answer:

APPLICATION SERVER

Explanation:

An application server is a server program in a computer which distribute network that provides the business logic for an application program.

Application server is a type of server designed to install, operate and host applications and associated services for end users.

Application software are usually the middleware that provides the glue connecting traditional corporate systems such are organisation or company to the customer as well as all the functionality needed to conduct e-commerce.

3 0
3 years ago
Read 2 more answers
You can access decorative underlines and change their color through the ____ drop-down.
Dominik [7]
The answer is "underline gallery or underline drop-down". The user can access the decorative underlines and change the underline's color through the underline gallery. Underlines can be added for decoration purposes, to make your work look formal or creative.
4 0
3 years ago
ནས་ད་ དང ་ ་ ་ ་ ་ Az - . Al & Co (NO) - Cat Al (NO) 0 --- - 2N: H2 +0 h20​
Tamiku [17]

Can you be more clear???

7 0
3 years ago
Other questions:
  • I have Mac(the last version installed) and I use Wine (application for using windows files, programmes on mac) but I have some p
    6·1 answer
  • Assume that to_the_power_of is a function that expects two integer parameters and returns the value of the first parameter raise
    13·1 answer
  • Matlab In this assignment you will write a function that will calculate parallel resistance for up to 10 parallel resistors. Cal
    15·1 answer
  • Making sure that your business has something special and distinct to offer is known as?
    12·1 answer
  • Holly has at most $828 to spend for moving from her old apartment. The moving company charges $80 per hour plus at rate of $300.
    9·1 answer
  • What do you expect the future trends of an operating system in terms of (a) cost (b) size (c) multitasking (d) portability (e) s
    12·1 answer
  • 1. Explain the difference between a web browser and a search engine. (2 points)
    8·1 answer
  • What does GUI stands for and what is it function?​
    5·2 answers
  • Madeleine's Instructor praised her for capturing a nearly perfect image. It included dominance, harmony, and proportion among ot
    13·1 answer
  • When determining the statement of purpose for a database design, what is the most important question to ask?
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!