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
Can anyone help me ?
IrinaVladis [17]

Answer:

System.out.printIn("Hello, world" );

Its " ); " and not " ) ; "

5 0
2 years ago
Briefly discuss the aesthetics and ergonomics of a hydraulic jack. First explain what these
ehidna [41]

Answer:

For this model, aesthetics is defined as a measure of how attractive a product appears, and ergonomics is how well a product feels when used/held. ... Two important types of defects, part flash and crush, will be used to define ergonomic and aesthetic PA's, respectively.

5 0
3 years ago
Which sentences or phrases in the passage hint at a bad work habit? Samantha works as an intern at a marketing firm. She always
Verdich [7]
<span>There are two sentences here that hint at a bad work habit.

1.She always shows up for work later than she is expected to but delivers her assignments as per her deadlines.

Here we see that Samantha not only is late to work, but she does it regularly. This is an example of a bad work habit, as being on time is one of the responsibilities of an employee. This also sends a bad massage to her coworkers, if she is not punished for it. That can lead to disorganization and loss of production.

2.She always tries her best to learn new skills even though she does not show up for work regularly.

Again, showing up for work is a must, except your company does not explicitly have a flexible work schedule that allows people to work from home or make their own working hours. In Samantha's case that does not seem to be the case and thus this is a bad habit. </span>
<span />
3 0
3 years ago
Which of these number systems uses the most unique characters?
makvit [3.9K]

Answer:

i say hexadecimals

Explanation:

The hexadecimal numeral system, often shortened to "hex", is a numeral system made up of 16 symbols (base 16). The standard numeral system is called decimal (base 10) and uses ten symbols: 0,1,2,3,4,5,6,7,8,9. Hexadecimal uses the decimal numbers and six extra symbols.

4 0
3 years ago
In the portrait mode your camera will automatically use the smallest apeture possible
Gemiola [76]
The answer is true. hope this helped
8 0
3 years ago
Other questions:
  • The Caesar Cipher has 25 different shifts to try.
    14·1 answer
  • What is the device called which typically combines the capabilities of a scanner, printer, fax, and copying machine?
    15·1 answer
  • 3. By default, Blender® remembers your last 32 actions and allows you to undo them one at a time by pressing CTRL+Z. (1 point)
    9·1 answer
  • For this assignment: Analyze and describe the network infrastructure. Describe and explain the various policies that will be nee
    11·1 answer
  • Joe, a user, has just installed his first home wireless router. Which of the following tasks should be considered to help secure
    8·1 answer
  • What is the film format that many filmmakers feel is superior to any other format?
    13·1 answer
  • Which statement will properly start the main() function? def main(): def Main def main# def main[]
    14·2 answers
  • Can someone write a 5 sentence summary about Virtual Assistants. Please. I'm in a rush. Personal problems.
    5·1 answer
  • When spraying pesticide wear and protective eyeglass​
    13·2 answers
  • 13. WHICH OF THE FOLLOWING IS INVOLVED IN CREATING A DOCUMENT? *
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!