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
mariarad [96]
3 years ago
5

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


Provided statement:


public String starOut(String str) {


//code goes here


}
Computers and Technology
1 answer:
wariber [46]3 years ago
3 0

Answer:

// class definition Solution

public class Solution {

   // main method to begin program execution

   public static void main(String args[]) {

       // the starOut method is called with argument

       starOut("ab*cd");

       starOut("ab*cd");

       starOut("sm*eilly");

   }

   

   // the starOut method is declared and it returns a string

   // it receive a string as the argument

   public static String starOut(String str) {

       // The index of the star is assigned to starIndex

       int starIndex = str.indexOf("*");

       // Index of character before star is known

       int charBeforeStar = starIndex - 1;

       // Index of character after star is known

       int charAfterStar = starIndex + 1;

       // The newString is declared empty

       String newString = "";

       // loop through the string

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

           // if i is either of the following index, the loop continue

          // without concatenating with the newString

           if (i == charBeforeStar || i == charAfterStar || i == starIndex){

               continue;

           }

           // the new string is concatenated with a character

           newString += str.charAt(i);

       }

       

   // the new string is printed

       System.out.println(newString);

       // the newString is returned

       return newString;

   }

}

Explanation:

The code logic is stated in the comment inside the code.

You might be interested in
or each array created, the name of the array becomes the name of the pointer constant created by the compiler for the array, and
JulijaS [17]

Answer:

The answer is "Starting address"

Explanation:

Arrays are a type of data structure that can store a fixed size successive assortment of components of a similar kind. An Array is used to store an assortment of data, yet it is regularly more valuable to consider a cluster an assortment of factors of a similar sort.

Rather than proclaiming singular factors, for example, number0, number1, ..., and number99, you declare one Array variable, for example, numbers and use numbers[0], numbers[1], and ..., numbers[99] to speak to singular factors. A particular component in a cluster is gotten to by a list.

All Arrays comprise of bordering memory areas. The most minimal address compares to the first element and the most highest address to the last element.

4 0
2 years ago
The security manager assigned a new security administrator the task of implementing secure protocols on all wireless access poin
Marysya12 [62]

Answer:

Good choice, as its one of the most secure wireless communications encryption methods, even though WPA2 would be the best

Explanation:

8 0
3 years ago
An online company wants to conduct real-time sentiment analysis about its products from its social media channels using SQL.
iogann1982 [59]

Answer:

An online company wants to conduct real-time sentiment analysis about its products from its social media channels using SQL. The solution which has lowest cost and operational burden is as follow:

B. Configure the input stream using Amazon Kinesis Data Streams. Use Amazon Kinesis Data Analytics to write SQL queries against the stream.

Explanation:

  • The option A is not correct as this solution doesn't have lowest cost and operational burden as set up a streaming data ingestion application on Amazon EC2 and connect it to a Hadoop cluster for data processing will have more cost and operational burden.
  • The lowest cost and operational burden solution is that we configure input stream using Amazon Kinesis Data Streams. We can use Amazon Kinesis Data Analytics to write SQL queries against the stream.
  • The option c and d are also more pricey in terms of cost and operational burden as compared to Amazon Kinesis Data stream and analytics.  

4 0
3 years ago
Why is the keyboard calledQWERTY
taurus [48]
The standard QWERTY layout keyboard is called 'QWERTY' because on the top line of the keyboard the first 6 letters from chronological left to right order are; Q, W, E, R, T, and Y.

Or...if you're wondering why it's QWERTY and not ABCDEF, it's because when typing with the alphabetical format, many of the keys would clash with each other due to the arrangement of keys on the original typewriter. The QWERTY layout became so popular, it was the standardized layout for typewriters, and even keyboards today.
4 0
3 years ago
Read 2 more answers
Before guis became popular, the _______________ interface was the most commonly used.
sineoko [7]
<span>Before GUIs became popular, the command line interface (CLI) was the most commonly used.
</span>GUI stands for Graphical User Interface . Like its name says it is a graphical interface <span>that allows interaction with users through graphical icons and visual indicators , rather than through text-based interface.</span><span>
Command line interace (CLI) is text-based interface in which </span>the user <span>issues commands to the program in the form of successive lines of text.</span>
6 0
3 years ago
Other questions:
  • What is working with others to find a mutually agreeable outcome?
    6·1 answer
  • Tell me about how to build robots
    11·1 answer
  • Enhancing and optimizing customer retention and loyalty is a major business strategy.
    15·1 answer
  • Up to 10 people is a good guideline for the size of your study group.
    15·1 answer
  • Gemima wants to show the amount of vitamin C a fruit salad contains in the blue cell of the table below. To do this, she needs t
    9·2 answers
  • If a*b = 2a - 56, calculate the value of<br>3 * 4​
    14·1 answer
  • Which career path includes the work duties of hiring and managing farm laborers?
    6·2 answers
  • How to turn off windows 10 without loosing sound?
    11·1 answer
  • Please its argent and I will give you BRAINLIEST ANSWER 6. How would you confirm that a colourless liquid given to you is pure w
    10·1 answer
  • What is the best way to improve an online search?
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!