Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Software engineer language: Java 53 MyCustomStringinterface java MyIndexOutOfBoundsException.java MyCustomString Test.java MyCustomString.java Keturns a Suring that consists OT all and only the characters in positions n,

image text in transcribed

image text in transcribed

Software engineer language: Java

53 MyCustomStringinterface java MyIndexOutOfBoundsException.java MyCustomString Test.java MyCustomString.java Keturns a Suring that consists OT all and only the characters in positions n, 2n, 31, ana 54 so on in the current string, starting either from the beginning or from the end of the * string. The characters in the resulting string should be in the same order and with the * same case as in the current string. 55 * If the current string is empty or has less than n characters, the method should return an * empty string. * Examples: - For n=2 and a string of one character, the method would return an empty string. * - For n=2 and start FromEnd-false, the method would return the 2nd, 4th, 6th, and so on characters in the string * . For n=3 and start FromEnd=true, the method would return the 3rd from the last character in the string, 6th from the last character in the string, and so on (in the order in which they appear in the string). * Values n and start FromEnd are passed as parameters. The starting character, whether it is * the first one or the last one in the string, is considered to be in Position 1. * @param n Determines the positions of the characters to be returned * @param startFromEnd Determines whether to start counting from the end or from the beginning when identifying the characters in position n, 2n, 3n, and so on. Please note that the characters are always returned in the order in which they appear in the string. * @return String made of characters at positions n, 2n, and so on in the current string * @throws IllegalArgumentException If "n" less than or equal to zero * @throws NullPointerException If the current string is null and "n" is greater than zero String getEverythCharacterFromBeginningOrEnd(int n, boolean startFromEnd); 48:10: 1213 184M of 256M 01 Writable Smart Insert * Returns a string that consists of all and only the characters in positions n, 2n, 3n, and * so on in the current string, starting either from the beginning or from the end of the * string. The characters in the resulting string should be in the same order and with the same ase as in the current string. If the current string is empty or has less than n characters, the method should return an * empty string. * Examples: - For n=2 and a string of one character, the method would return an empty string. - For n=2 and start FromEnd-false, the method would return the 2nd Ath/6th, and so on characters in the string. - For n=3 and startFromEnd=true, the method would return the 3rd from the last character in the string, 6th from the last character in the string, and so on in the order in which they appear in the string). * Values n and startFromEnd are passed as parameters. The starting character, whether it is * the first one or the last one in the string, is considered to be in Position 1. * param n Determines the positions of the characters to be returned * @param startFromEnd Determines whether to start counting from the end or from the beginning when identifying the characters in position n, 2n, 3n, and so on. Please note that the characters are always returned in the order in which they appear in the string. * @return String made of characters at positions n, 2n, and so on in the current string * @throws IllegalArgumentException If "n" less than or equal to zero * @throws NullPointerException If the current string is null and "n" is greater than zero

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Principles Of Database Systems With Internet And Java Applications

Authors: Greg Riccardi

1st Edition

020161247X, 978-0201612479

More Books

Students also viewed these Databases questions

Question

2. Do the easy questions first.

Answered: 1 week ago