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
Choose the correct line of code.
Naddika [18.5K]
Def_pow_(self,b): if not then I’m sorry
5 0
3 years ago
What data type or you use to represent true or false values?
vfiekz [6]
The Boolean type is used to represent true or false values
3 0
2 years ago
What are the differences and similarities of computer virus and biological virus. Give 4 examples
Papessa [141]

Answer:

During recent months, we’ve witnessed an unexpected and distressing pandemic of a coronavirus disease. What I find especially distressing about it is how the worldwide adversity was caused by just a tiny thing — namely, a virus called SARS-CoV-2.

However, biological viruses have always been a potent threat to humanity, as historic pandemics have proved. No wonder viruses became an ideal weapon model in a totally different world — a world of programming. The first computer viruses were created as early as in the 1970s. Starting as pranks, they evolved to become a major threat to the stability of computer networks worldwide. And the more I think of viruses, both biological and digital, the more amazed I am by their similarities.

We don’t know what kind of challenges viruses of either type will cause in the future, but understanding how they infect, the symptoms they induce, how they spread, and the damage they can cause can help us fight both.

The Common Thread

Let’s start with the basics: What does a virus look like?

computer virus of 1999

Click image for larger version

Figure 1: Pictured on the left is an electron microscope image of SARS-CoV-2 particles - the pandemic-causing coronavirus. Source: NIAID-RML. Pictured on the right is a code snippet of a Melissa, the notorious email-spreading computer virus of 1999. Source: Gizmodo.

The images in Figure 1 might look vastly different, but, essentially, they’re the same: a string of code. In the coronavirus, it’s the RNA genome in a shell; in Melissa, it’s computer code. In both cases, the code is an “instruction” for the virus to follow.

Explanation:

here is your answer hope you will enjoy

thank you

6 0
2 years ago
Write a C program that displays your name and address (or if you value your privacy, a frictionless name and address)
rosijanka [135]

Answer:

Following are the program in c language

#include <stdio.h> // header file

int main() // main method

{

   char name[90]="mantasa"; // storing name

   char add[90]="120 lal bangla mumbai"; // storing address

    printf("\n Name:%s\nAddress:%s",name,add); // print name and address

   return 0;

}

Output:

Name:mantasa

Address:120 lal bangla mumba

Explanation:

In this program we are declaring the two array of char type which will store the name and address . after that we display name and address.

7 0
3 years ago
The small, touch-sensitive area at the base of the keyboard on a notebook computer is known as a ________.
USPshnik [31]
Trackpad.

(Sheep sheep mr sheep meep)
8 0
3 years ago
Read 2 more answers
Other questions:
  • The salesperson in a cell phone store is telling me that the phone I'm considering has 8GB of memory, which means I can save 10,
    13·1 answer
  • On the Picture Tools Layout tab, you can preview results of the numerous styles, borders, effects, and layouts by _______ comman
    7·2 answers
  • What are multiple worksheets
    7·1 answer
  • Perform the following conversions from decimal to binary, octal and hexadecimal systems. a) 1710 b) 132110C) 36010d).7510e).3906
    8·1 answer
  • A computer supply company is located in a building with three wireless networks.
    10·1 answer
  • Hurry please
    12·1 answer
  • To answer the research question "How am I going to find the information I need on the tople?" the best thing Georgia should
    15·1 answer
  • How do I insert a row above the selected row in between row and row 2 revenue xls
    5·1 answer
  • java Write a program that reads a list of words. Then, the program outputs those words and their frequencies. The input begins w
    11·1 answer
  • What is the difference between EPROM and EEPROM, explain why​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!