Reference no: EM131082090
Introduction to Programming in Java - Reversed Sentence
Read three sentences from the console application. Each sentence should not exceed 80 characters. Then, copy each character in each input sentence in a [3 x 80] character array.
The first sentence should be loaded into the first row in the reverse order of characters - for example, "mary had a little lamb" should be loaded into the array as "bmal elttil a dah yram".
The second sentence should be loaded into the second row in the reverse order of words - for example, "mary had a little lamb" should be loaded into the array as "lamb little a had mary".
The third sentence should be loaded into the third row where if the index of the array is divisible by 5, then the corresponding character is replaced by the letter ‘z' - for example, "mary had a little lamb" should be loaded into the array as "mary zad azlittze lazb" - that is, characters in index positions 5, 10, 15, and 20 were replaced by ‘z'.
Note that an empty space is also a character, and that the index starts from position 0. Now print the contents of the character array on the console.
Program is written as per the application programming interface (API).
ReversedSentence
- Attributes
- Operations
+ public static String change5thPosition(String s)
+ public static String printChar2DArray(char[][] arr)
+ public static String reverseByCharacter(String s)
+ public static String reverseByWord(String s)
+ public static String truncateSentence(String s)
Draw the tree for this experiment and find p[c1], p[c2]
: Draw the tree for this experiment and find P[C1], P[C2], and P[Cn].
|
What challenges does this pose for greyhound
: How would you describe BoltBus's strengths, weak-nesses, opportunities, and threats? Where does BoltBus fit within Greyhound's levels of strategic planning? What challenges does this pose for Greyhound?
|
Compute the capitalized costs for alternates
: Compute the ”Capitalized Costs” for Alternates “ R” and” S” using the interest rate of 10% and then select the best choice. “ R “ First Cost - $120,000, Annual Operating Cost - $40,000, Salvage Value - $50,000, and Life (years) - 5. “ S “ First Cost ..
|
Determine partial derivatives are positive or negative
: Quiz 4. Level curves are shown for a function f. Determine whether the following partial derivatives are positive or negative at the point P
|
Write a program as per the application programming interface
: Program is written as per the application programming interface (API). Read three sentences from the console application. Each sentence should not exceed 80 characters. Then, copy each character in each input sentence in a [3 x 80] character array.
|
In economy with income taxes
: In an economy with income taxes, if the marginal propensity to consume were 0.8, the tax rate on income were 0.2, and the marginal propensity to import were zero: (a) How large an increase in government spending (with no change in taxes) would be req..
|
How many pounds of potatoes will she purchase
: Janice really likes potatoes. At best any other goods are worth less than a dollar to her, potatoes cost $1.10 per pound, and she has $5.00 that she could possibly spend on potatoes or other items. Suppose she feels that the first pound of potatoes i..
|
Explain the significance of realignment in american politics
: Explain the significance of realignment in American politics and make a prediction as to which groups may switch parties in the near (0-16 years) future
|
Shopping atmosphere based on your initial reaction
: From the second e-Activity, evaluate the success of the company's retail image and its shopping atmosphere based on your initial reaction to the company Website.
|