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
Veseljchak [2.6K]
3 years ago
8

It is common for people to name directories as dir1, dir2, and so on. When there are ten or more directories, the operating syst

em displays them in dictionary order, as dir1, dir10, dir11, dir12, dir2, dir3, and so on. That is irritating, and it is easy to fix. Provide a comparator that compares strings that end in digit sequences in a way that makes sense to a human. First compare the part before the digit as strings, and then compare the numeric values of the digits.
Your program should work with the provided test program
DirectorySortDemo.java.
Call the class you write DirectoryComparator.java.
Submit the two files in your submission.
DirectoryComparator.java
DirectorySortDemo.java
import java.util.ArrayList;
import java.util.Arrays;
import java.util.collections;
public class DirectorySortDemo
{
public static void main (String [] args)
{
String dirNames ("dir12", "dir5", "dir9", "dirl", "dir4",
"lab10", "1ab2", "lab7", "lab17", "lab8",
"quiz8", "quiz10", "quiz11", "quiz12",
"dirll", "dir8", "dir7", "dir15", "dir3");
ArrayList directories = new
ArrayList<> (Arrays.asList (dirNames));
System.out.println ("Unsorted List:");
System.out.println (directories);
Collections.sort (directories, new DirectoryComparator ());
System.out.println ():
System.out-println ("Sorted List: ");
System.out.-println (directories);
Computers and Technology
1 answer:
Vikki [24]3 years ago
7 0

Answer:

Here the code is given as follows,

Explanation:

You might be interested in
Which of the following best describes a situation where software should be upgraded instead of replaced?
ad-work [718]

an OS systems security is at a high risk to hackers so the company can update the OS to improve security

7 0
3 years ago
Which of the following functions sends the the GPA entered by the user to the calling function? A. def get_gpa(): gpa = float(in
anzhelika [568]

Answer:

option c is the correct answer for the above question.

Explanation:

  • The above function code which is written in the option is written in the python language. So when a user wants an entered gpa value returned by the function then there is a code of return statement which returned the input value.
  • Option c states a function which first takes the value from the user and stores it into a gpa variable, then it returns the value of that variable by a return function.
  • This option is able to return the user input value to the calling statement while the other option is not able to because there is no return statement in other options.
  • Hence option c is the correct answer.
8 0
3 years ago
Please help me i’ll give you brainlist
Genrish500 [490]

answer: C

explanation: because it's the biggest of the given platforms

5 0
2 years ago
A process model can _____.
stepan [7]

Answer:

25&⁴⁸/⅘kindly⁶⁸/⁵⅞8⁹⁰/⁴⁵

8 0
2 years ago
There is something wrong with the arguments the function is getting; a precondition is violated​
Evgesh-ka [11]

Answer:

It indicates that either the argument is not corresponding to the perimeter or not returning the same as the variable or function. They arise a syntax error and Python parser is unable to understand a line of code.

Explanation:

8 0
3 years ago
Other questions:
  • I am having trouble with logic gates(AND NOR,etc)
    8·2 answers
  • Which of the following is an example of indirect perception checking?
    7·2 answers
  • Which of the choices Sean are not true when considering virus behavior
    9·1 answer
  • (Display four patterns using loops) Ask the user to enter an integer to
    8·1 answer
  • What is a prototype ?
    9·1 answer
  • Please answer<br><br>NO LINKS​
    7·1 answer
  • For what specific purpose is the TM9400 P25 Mobile designed? What is the benefit of having a mobile communications device that a
    10·1 answer
  • What is a network computer that processes requests from a client server​
    11·1 answer
  • When you _______ the top row or the left column, you can keep column headings and row labels visible as you scroll through your
    8·1 answer
  • Why linked list is better than an array?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!