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]
2 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]2 years ago
7 0

Answer:

Here the code is given as follows,

Explanation:

You might be interested in
What should you do if ads keep popping up on your computer when using Google Chrome?
romanna [79]
I think it’s B.. I’m pretty sure
8 0
3 years ago
All cells in row 2 through 5 are referred as 2:5 true or false
Simora [160]
<h3>Answer:</h3><h2>TRUE</h2>

Explanation:

BRAINLIEST PLSSSSSSSSSSSSSSSSSSS

8 0
2 years ago
3.
jenyasd209 [6]
Data label and pie slice
3 0
2 years ago
How to you compute for the total room sales​
Furkat [3]

Answer:

[checking question] - Error:

Please give complete/specific questions so more brainies will be able to help you! Check out what makes a great answer/question here: https://faq.brainly.com/hc/en-us/articles/360010136959-Answering-Guidelines ߷

7 0
3 years ago
Write a program that reads the balance and annual percentage interest rate and displays the interest for the next month. Python
denis23 [38]

Answer:

Explanation:

The following code is written in Python. It asks the user to enter the current balance and the annual interest rate. It then calculates the monthly interest rate and uses that to detect the interest that will be earned for the next month. Finally, printing that to the screen. A test output can be seen in the attached picture below.

balance = int(input("Enter current Balance: "))

interest = int(input("Enter current annual interest %: "))

interest = (interest / 12) / 100

next_month_interest = balance * interest

print('$ ' + str(next_month_interest))

7 0
2 years ago
Other questions:
  • We have to calculate the percentage of marks obtained in three subjects (each out of 100) by student A and in four subjects (eac
    11·1 answer
  • Write a function `has_more_zs` to determine which of two strings contains # more instances of the letter "z". It should take as
    9·1 answer
  • A ____ is harmful computer code that spreads without your interaction, slipping from one network to another and replicating itse
    15·1 answer
  • Briefly describe "SoftwareEngineering Framework". Do provide examples and diagrams wherenecessary.
    15·1 answer
  • What are some facts about webmasters?
    10·1 answer
  • Which type of address is used at the transport layer to identify the receiving application?
    14·1 answer
  • (TCO B) The symbol shown as a three-sided box that is connected to the step it references by a dashed line is what?
    12·1 answer
  • Roger wants to give semantic meaning to the contact information, which is at the bottom of the web page. To do this he will use
    5·1 answer
  • What do you think Amazon should fix?
    13·2 answers
  • Create a program which reads in CSV data of Creatures and loads them into aHash Map. The key of this hash map will be the name o
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!