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
Damm [24]
4 years ago
5

Write a method, getSecondLine, that is passed a String argument and that returns the second line, without its newline character.

(Recall that lines are terminated with the "\n" character.) Assume that the argument contains at least two complete, newline-terminated lines.
Computers and Technology
1 answer:
laiz [17]4 years ago
6 0

Answer:

The answer to this question can be given as:

Method definition :

String getSecondLine (String aString) //define function getSecondLine()

{

return aString.substring(aString.indexOf("\n") + 1, aString.indexOf("\n") + 1 + aString.substring(aString.indexOf("\n") + 1, aString.length()).indexOf("\n"));

//return value.

}

Explanation:

The working of the function definition can be given as:

In the above function definition we define getSecondLine() function.

This function returns string value because we use the string return type.

In this getSecondLine() function we pass the a string variable that use substring function which return a string into parts.

In the substring function we use the indexOf function that is used to return the position of the string.

In this method definition, it will return the string value into the new lines.

You might be interested in
In case of a suspected data breach, what course of action should a chief information security officer (CISO) take
guapka [62]

Answer

1. Assemble his team

2. Find reason for breach

3. Evaluate what was lost

4. Ensure password change

Explanation:

In case of a suspected breach, the Chief information security officer should first of all assemble his incidence response team. This team should have representatives from all areas of the organization.

Then the reason for the breach and how access was gained has to be found out. An evaluation of what has been lost in the breach would be carried out and it's likely impact on the company.

In case credentials were stolen the CISO has to ensure that the employees change passwords. Also he has to notify all the necessary parties about the breach.

The CISO has to ensure that all employees are trained properly on security and they comply to security policies.

7 0
3 years ago
Given the list of customer segments below please create a new list of the names of the segments only using(a) a for loop(b) a li
Alchen [17]

Answer:

new_segment = [ ]

for segment in segments:

   new_segment.append({'name': segment, 'average_spend': money})

print( new_segment)

Using list comprehension:

new_segment =[{'name': segment, 'average_spend': money}  for segment in segments]

Using map():

def listing(a):

   contain =  {'name': segment, 'average_spend': money}

   return contain

new_segment = [ ]

new_segment.append(map( listing, segment))

print(list(new_segment)

Explanation:

The python codes above create a list of dictionaries in all instances using for loop, for loop in list comprehension and the map function which collect two arguments .

7 0
3 years ago
Diane wants to maintain a record of grades she scored in the fifth, sixth, and seventh grades. She enters her grades and the tot
sammy [17]
The answer of the given question above would be the second option: NUMBERS. Based on the given scenario above about Diane who wants to maintain a record of grades she scored in the fifth, sixth, and seventh grades and enters  her grades and the total percentage she scored in a spreadsheet, the tab o<span>n the Format Cells dialog box that will enable her to display the total percentage symbol in the spreadsheet would be the Numbers. Hope this helps.</span>
6 0
3 years ago
Read 2 more answers
An RSS feed allows an organization to publish new content on a website, blog or other platform and syndicate this to subscribers
yuradex [85]
Makes it easier for people to subscribe to your webpage without having to go and visit it.
3 0
4 years ago
Edhesive Intro to CS: 3.4 Code Practice: Question 1, Input a word. If it is "yellow," print "Correct." Otherwise, print "Nope."
Novosadov [1.4K]

Answer:

yes it does

Explanation:

4 0
3 years ago
Read 2 more answers
Other questions:
  • Describe in one or more complete sentences how someone starting a computer repair business in a town night gain a competitive ad
    15·1 answer
  • Write a shell script to count down from two hours to zero seconds using the hour, minute, second display format utilizing the sh
    5·1 answer
  • Double any element's value that is less than controlValue. Ex: If controlValue = 10, then dataPoints = {2, 12, 9, 20} becomes {4
    8·2 answers
  • Categories of general purpose application software and examples each​
    13·1 answer
  • Your computer uses 4 bits to represent decimal numbers (0, 1, 2, 3 and so on) in binary. What is the SMALLEST number
    11·1 answer
  • Minimalism is a major movement in postmodern art. O True O False
    14·1 answer
  • What are examples of people who own the copyrights of their property? Check all that apply.
    10·2 answers
  • Although the Earth's crust formed relatively early in the Earth's history, it was not present when the Earth first began to form
    12·2 answers
  • One concern some users have about storing data or accessing applications in the cloud is .
    10·1 answer
  • Developed the first compiler and conducted work that led to the development of COBOL ?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!