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
3 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]3 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
Set-In-Order includes making changes to the layout of the area.A) TrueB) False
Bogdan [553]

Answer:

A) True

Explanation:

Set-In-Order is part of a 5S system approach of making a workplace to be well arranged so there will be smooth operation of employees and working conditions.

Set-In-Order specifically deals with entities in the workplace apparently labeled after being well arranged in their respective places.

Hence, it is TRUE that Set-In-Order includes making changes to the layout of the area.

7 0
3 years ago
Please help!!!
Leona [35]

Answer:

C. Forms often provide special tools such as drop-down boxes for finding data.

Explanation:

3 0
3 years ago
Briefly describe the function of options in a linux command and give an example of a useful option.
EleoNora [17]

The function of options in a linux command is to to influence the behavior of defined shell scripts and help execute the desired tasks.

<h3>What are options in linux command line?</h3>

In the Linux OS, these options are a list of flags and other parameters that can control the behavior of the wt command line as a whole.

Some examples of options in a linux command includes:

  • cd command
  • ls command
  • cat command
  • cp command
  • mv command
  • mkdir command
  • rmdir command.

In conclusion, the function of options in a linux command is to to influence the behavior of defined shell scripts and help execute the desired tasks.

Read more about linux command

brainly.com/question/25480553

#SPJ4

5 0
2 years ago
We are learning about raspberry pi in my class and I don't know the answers to these two questions
Reptile [31]
Answer: no idea





Explanation:
8 0
3 years ago
Write a algorithm to find area and perimeter of an parrallelogram computer science class 12.​
sattari [20]

Answer:  Program to calculate area of a parallelogram

Find area of parallelogram if vectors of two adjacent sides are given

Area of a triangle inside a parallelogram

Perimeter and Area of Varignon's Parallelogram

Program for Circumference of a Parallelogram

Program to print the hollow numerical parallelogram

Find the Missing Point of Para

Explanation:

3 0
3 years ago
Other questions:
  • Which of the following is not a basic role of a webmaster
    8·1 answer
  • &gt;&gt;&gt; import math &gt;&gt;&gt; print(math.Pi) 3.141592653589793 &gt;&gt;&gt; def print_volume(): print ("What is the radi
    12·1 answer
  • What names of websites of presentation or visualization <br>​
    15·1 answer
  • Before his job interview, Shabnam took the time to carefully wash and iron his best khaki pants and a button-down shirt. He even
    15·2 answers
  • What does a virus do to a computer? How can it be fixed?
    9·1 answer
  • Select the correct answer.
    11·1 answer
  • Given the following statement, what is the value of myExample?
    13·1 answer
  • What is the effects of computer and internet attacks​
    11·2 answers
  • Example of Bandwidth Analogies: using Pipe
    11·2 answers
  • Question 7 Consider the following code:
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!