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
Marta_Voda [28]
3 years ago
11

Return a version of the given string, where for every star (*) in the string the star and the chars immediately to its left and

right are gone. So "ab*cd" yields "ad" and "ab**cd" also yields "ad". starOut("ab*cd") → "ad" starOut("ab**cd") → "ad" starOut("sm*eilly") → "silly"
Computers and Technology
1 answer:
lana [24]3 years ago
4 0

Answer:

Explanation:

The following code is written in Java and uses a for loop with a series of IF ELSE statements to check the next and previous characters in a string. Checking to make sure that there are no asterix. If so it adds that character to the String variable output. Which is returned to the user at the end of the method. Two test cases have been created and the output can be seen in the attached image below.

class Brainly {

   public static void main(String[] args) {

       System.out.println(starOut("sm*eilly"));

       System.out.println(starOut("ab**cd"));

   }

   public static String starOut(String str) {

       String output = "";

       for (int i = 0; i < str.length(); i++) {

           if ((i != 0) && (i != str.length()-1)) {

               if ((str.charAt(i-1) != '*') && (str.charAt(i+1) != '*') && (str.charAt(i) != '*')) {

                   output += str.charAt(i);

               }

           } else {

               if ((i == 0) && (str.charAt(i) != '*') && (str.charAt(i+1) != '*')) {

                   output += str.charAt(i);

               } else if ((i == str.length()-1) && (str.charAt(i) != '*') && (str.charAt(i-1) != '*')) {

                   output += str.charAt(i);

               }

           }

       }

       return output;

   }

}

You might be interested in
_is the joining of two or more electrical conductors by mechanically twisting the conductors together or by using a special spli
adell [148]

Splicing is the joining of two or more electrical conductors by mechanically twisting the conductors together or by using a special splicing device.

Which is an electrical conductor?

An electrical current flows through a conductor because it provides little to no resistance to the movement of electrons. Typically, good electrical conductors include metals, metal alloys, electrolytes, and even some nonmetals like graphite and liquids like water.

What is the purpose of a splice?

It can be used to package and stop the fraying of rope ends as well as as a foundation for more complex knots like the surgeon's knot and the square knot. Wrap the rope end around the standing part to form a loop, then bring the end of the loop through and draw the rope taut to tie an overhand knot.

Is it safe to splice electrical wire?

The splice may overheat and pose a fire risk when the current passes through it. Always utilize a junction box to store all the spliced wires while splicing wires. Any sparks produced during a short circuit are contained in junction boxes, which offer protection from electrocution and fires.

Learn more about electrical conductors: brainly.com/question/28209810

#SPJ4

4 0
1 year ago
Christina has been asked by the firewall administration group to identify secure network protocols that can be used to prevent n
kotegsom [21]

Answer:

SSH, HTTPS and SMTP

Explanation:

Data theft can be defined as a cyber attack which typically involves an unauthorized access to a user's data with the sole intention to use for fraudulent purposes or illegal operations. There are several methods used by cyber criminals or hackers to obtain user data and these includes DDOS attack, SQL injection, man in the middle, phishing, etc.

Encryption is a form of cryptography and typically involves the process of converting or encoding informations in plaintext into a code, known as a ciphertext. Once, an information or data has been encrypted it can only be accessed and deciphered by an authorized user.

Some examples of encryption algorithms are 3DES, AES, RC4, RC5, and RSA.

Hence, SSH, HTTPS and SMTP are considered as secure network protocols.

HTTPS is acronym for Hypertext Transfer Protocol Secure while SSL is acronym for Secure Sockets Layer (SSL).

SMTP is an acronym for Simple Mail Transfer Protocol and it uses the standard port number of 25 to provide clients with requested services.

6 0
3 years ago
Which of the following are techniques that companies use to influence consumers demand for their goods and services
Lesechka [4]
A. Turning luxuries into necessaties
5 0
3 years ago
Read 2 more answers
Walt has selected data in a worksheet and inserted a chart. However, the chart is inserted right on top of the data set, and he
Marianna [84]

Answer:

Click View and zoom into the worksheet so the chart is easily visible.

Explanation:

5 0
3 years ago
Read 2 more answers
Which of the following was the first full-length film to be done completely in 3-D imaging
motikmotik
Toy story I believe is the answer
6 0
2 years ago
Read 2 more answers
Other questions:
  • Productivity software has been used for a number of years. Recent advancements in productivity software technology have made ___
    14·1 answer
  • which of these paste options is commonly available from the paste options button? A&gt; use the destination them. B. keep the em
    14·2 answers
  • Hot five was the famous band of which musician?
    14·1 answer
  • If you are working in a word-processing program and need to learn more about its features, the best place to get assistance is f
    7·2 answers
  • Your organization issues devices to employees. These devices generate one-time passwords every 60 seconds. A server hosted withi
    15·1 answer
  • How can you ensure you don't go over your budget?
    8·1 answer
  • Gabriel needs to create a formula that does not change when it is copied to cell b2. which formula should he create?
    14·1 answer
  • This is pixlr
    6·1 answer
  • Which picture should i put as my profile picture.
    15·2 answers
  • Question 12 (5 points)
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!