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
Are principles which allow designers to create blank designs
Lady_Fox [76]

Answer:

Seven principles guiding blank design

see below

Explanation:

The correct question should be What Are principles which allow designers to create blank designs

"Are principles which allow designers to create blank designs"

Blank design first screen user is presented with when about to start something new.

The seven principles are

  • Balance
  • Rhythm
  • Pattern
  • Emphasis
  • Contrast
  • Unity
  • Movement
7 0
3 years ago
List 5 object which are considered part of ICT. explain its function.
UNO [17]

Answer:

Here it is

Explanation:

Processing is not considered as the tool of ICT. Explanation: ICT is Information and Communication Technology. This is one of the trending technologies with new concepts.

7 0
3 years ago
B. Identify the purpose of each of the following types of utility programs
olya-2409 [2.1K]

<u>These are the types </u>:

1. Antivirus software : Detects and removes virus and malwares from   computer system.

2.Disk defragmenter : Reduces the fragmented space in the disk.

3.Disk cleaner : Build to find and delete unwanted files to free the disk space.

6 0
4 years ago
Eight houses represented as cells are arranged in a straight line java int state []
monitta

Answer:

int state[] = new int[8];

8 0
4 years ago
All of the following are report sections EXCEPT (Points : 4) detail.
lord [1]

Answer:Summary

Explanation: Summary is the briefing of any information or data and reducing the details about the subject.It is not a part of the report while it is designed because detailing is the part where the description is mentioned with every element so the requirement for summary is in that part and not in the report.

Other option are the part of the report designing because group footer is used for presenting the summaries of group, page footer the area below the main text and detail is the description of every element of the subject.Thus the only exception in the designing of report is summary.

6 0
3 years ago
Other questions:
  • Write the printitem() method for the base class. sample output for below program: last name: smith first and last name: bill jon
    6·2 answers
  • Enter the name of your school or work URL and generate report.What score did it receive?
    9·1 answer
  • How much mobile data does maps use
    6·1 answer
  • Trish has bought a new computer that she plans to start working on after a week. Since Trish has not used computers in the past,
    10·1 answer
  • (tco 3) what vbscript boolean operator could be used to replace the nested selection structure in this pseudocode? if empmedical
    13·1 answer
  • Which of the following is a proper use of the application NetStumbler?Which of the following is a proper use of the application
    10·2 answers
  • Â A number of companies and/or agencies, such as National ____ and Atmospheric Administrationâs National Weather Service, provid
    9·1 answer
  • A customer has an application that is used by enterprise customers outside of AWS. Some of these customers use legacy firewalls
    9·1 answer
  • ____ is a technology that exists inside another device
    9·2 answers
  • After 4th collision in ethernet, find the maximum time that the adapter waits until sensing the channel again for a 100 mbps bro
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!