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
monitta
2 years ago
7

An anagram is a word or a phrase made by transposing the letters of another word or phrase; for example, "parliament" is an anag

ram of "partial men," and "software" is an anagram of "swear oft." Write a program that figures out whether one string is an anagram of another string. The program should ignore white space and punctuation.
Computers and Technology
1 answer:
Sliva [168]2 years ago
4 0

Answer:

Anagram

Explanation:

public class Anagram {

   public static boolean areAnagrams(String string1,

                                     String string2) {

       String workingCopy1 = removeJunk(string1);

       String workingCopy2 = removeJunk(string2);

    workingCopy1 = workingCopy1.toLowerCase();

    workingCopy2 = workingCopy2.toLowerCase();

    workingCopy1 = sort(workingCopy1);

    workingCopy2 = sort(workingCopy2);

       return workingCopy1.equals(workingCopy2);

   }

   protected static String removeJunk(String string) {

       int i, len = string.length();

       StringBuilder dest = new StringBuilder(len);

   char c;

    for (i = (len - 1); i >= 0; i--) {

        c = string.charAt(i);

        if (Character.isLetter(c)) {

         dest.append(c);

        }

    }

       return dest.toString();

   }

   protected static String sort(String string) {

    char[] charArray = string.toCharArray();

    java.util.Arrays.sort(charArray);

       return new String(charArray);

   }

   public static void main(String[] args) {

       String string1 = "Cosmo and Laine:";

       String string2 = "Maid, clean soon!";

       System.out.println();

       System.out.println("Testing whether the following "

                        + "strings are anagrams:");

       System.out.println("    String 1: " + string1);

       System.out.println("    String 2: " + string2);

       System.out.println();

       if (areAnagrams(string1, string2)) {

           System.out.println("They ARE anagrams!");

       } else {

           System.out.println("They are NOT anagrams!");

       }

       System.out.println();

   }

}

You might be interested in
Computer spreadsheet is a grid of​
Kruka [31]
Huh we’re, we’re is the computer screen shot
3 0
2 years ago
An early attempt to force users to use less predictable passwords involved computer-supplied passwords. The passwords were eight
Sedaia [141]

Answer:

Recently, with the new and advanced hacking algorithms and affordable high-performance computers available to adversaries, the 36 character computer suggested passwords can easily be insecure.

Explanation:

The 8 length passwords generated pseudo-randomly by computers are not secure as there are new algorithms like the brute force algorithm that can dynamically obtain the passwords by looping through the password length and comparing all 36 characters to get the right one.

And also, the use of high-performance computers makes these algorithms effective

7 0
3 years ago
You type a complex formula in cell A20. You would like to make the same calculation in cells B20 through H20. To be efficient, y
fomenos

Answer:

Use autofill

Explanation:

In excel "autofill" is used to fill data in cells, which follows the pattern or logic applied in other cells. To apply same calculation of A20 in B20 to H20, we use autofill technique. Instead of copy pasting, or manually entering the complex formula this method is more suitable.  

4 0
3 years ago
What is the term for the era created by the digital revolution?
Ahat [919]
Technological innovation
8 0
3 years ago
How do you do this question?
laila [671]

Answer:

(a) 1 to 8

(b) 1 to 6

Explanation:

A "leaf" is a node at the end of a binary tree (in other words, it has no "children").  All other nodes are "non-leaf" nodes.

The smallest number of leaves is 1.  That would be a binary tree that's just a straight line; each node will have only 1 child, until you get to the last node (the leaf).

To find the largest number of leaves, we start drawing a full binary tree.  A complete tree with 15 nodes has 7 non-leaf nodes and 8 leaf nodes.  A full tree with 6 non-leaf nodes can have up to 6 leaf nodes.

6 0
3 years ago
Read 2 more answers
Other questions:
  • What is the name for an object that is what it appears to be?
    11·1 answer
  • ______ means locating a file among a set of file​
    14·1 answer
  • ​if a primary key combines two or more fields, then it is called a _____.
    14·1 answer
  • How to fix dark images?<br><br>I am using a phone btw​
    14·2 answers
  • Read the section, "Junior Year." Why would someone chose to complete an apprenticeship after high school? How many occupations c
    14·2 answers
  • Which is the best choice to explain why a human resource manager is so
    5·1 answer
  • "Bookings are to be stored in three separate
    7·1 answer
  • Select the best answer from the drop-down menu.
    14·2 answers
  • Using computers can lead to a number of physical safety issues. State and explain TWO(2) of these types of issues.​​​​​
    12·1 answer
  • when inputting a formula into excel or other spreadsheet software, what components are required for the formula to function prop
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!