0

New help with a program for Java. Question in description.

Assignment 7 Write a program to accept a sentence which may be terminated by either or ? only. The words are to be separated by a single blank space. Print an error message if the input does not terminate with "." or '?". You can assume that no word in the sentence exceeds 15 characters, so that you get a proper formatted output. Perform the following tasks: (i) Convert the first letter of each word to uppercase. (ii) Find the number of vowels and consonants in each word and display them with proper headings along with the words. Test your program with the following inputs. Example 1 INPUT: Intelligence plus character is education. OUTPUT: Intelligence Plus Character Is Education Word Vowels Consonants Intelligence 5 7 Plus 1 3 Character 3 6 Is 1 1 Education 5 4

27th Dec 2021, 2:25 PM
Sunil
5 odpowiedzi
+ 2
Sunil Use String's "split" method it allows you to split a String into an array of sub substrings at a specified location. Example - String a = "I ain't kidding"; String words[] = a.split(" "); // words : ["I", "ain't", "kidding"]
27th Dec 2021, 2:43 PM
マッドキング♣️✨♣️ [MadKing]
マッドキング♣️✨♣️ [MadKing] - avatar
+ 1
Kindly show your attempt to help you to debug your error I don't have the code now.
27th Dec 2021, 2:49 PM
Sunil
+ 1
_Aysha_ That's not like that, maybe he's newbie anyways Sunil https://code.sololearn.com/cjUfAyv4lNTr/?ref=app here's the basic code ,do that styling stuff yourself
27th Dec 2021, 3:01 PM
マッドキング♣️✨♣️ [MadKing]
マッドキング♣️✨♣️ [MadKing] - avatar
+ 1
_Aysha_ Alright
27th Dec 2021, 5:11 PM
マッドキング♣️✨♣️ [MadKing]
マッドキング♣️✨♣️ [MadKing] - avatar
0
Ok Thank You I will post my code as soon as possible
27th Dec 2021, 3:09 PM
Sunil