Question: Write a program that reads a sentence and then prints a diamond shaped tree for every word in the sentence. As an example, if the

 Write a program that reads a sentence and then prints a

Write a program that reads a sentence and then prints a diamond shaped tree for every word in the sentence. As an example, if the string has the value "sample text", then the program should print the pattern (as shown, in capitals for each word) Save As Assign21 Enter a Sentence: sample text S SAS Note: The split function can be used SAMAS to separate the words in the SAMPMAS sentence. SAMPLPMAS SAMPLELPMAS String words; SAMPLPMAS SAMPMAS words=sentence.split(" "); SAMAS SAS This will place each word into an array S based on a space. A M P L T TET TEXET TEXTXET TEXET TET T E X The program should work for any string of any size

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!