nextLine
and a header value) fom the file strings.text
,
and prints out various properties and manipulations of the individual strings. The program should also sort the strings and
print them out in sorted order. (This exercise is similar to Lab 14)
As each string is read in, you should print out:
Sample Test Run
For example if the file strings.text
contains:
8 The quick brown fix jumped over the lazy brown dog. Hello world! CISC 1115 is and introduction to Java just... some ... words madam im adam madamimadamthe program should produce the following output:
original string: The quick brown fix jumped over the lazy brown dog. reversed : .god nworb yzal eht revo depmuj xif nworb kciuq ehT vowels removed : Th qck brwn fx jmpd vr th lzy brwn dg. plural : The quick brown fix jumped over the lazy brown dog.s isCapitalized : true containsBlanks : true original string: Hello world! reversed : !dlrow olleH vowels removed : Hll wrld! plural : Hello world!s isCapitalized : true containsBlanks : true original string: CISC 1115 is and introduction to Java reversed : avaJ ot noitcudortni dna si 5111 CSIC vowels removed : CSC 1115 s nd ntrdctn t Jv plural : CISC 1115 is and introduction to Javas isCapitalized : true containsBlanks : true original string: just... reversed : ...tsuj vowels removed : jst... plural : just...s isCapitalized : false containsBlanks : false original string: some ... reversed : ... emos vowels removed : sm ... plural : some ...s isCapitalized : false containsBlanks : true original string: words reversed : sdrow vowels removed : wrds plural : wordses isCapitalized : false containsBlanks : false original string: madam im adam reversed : mada mi madam vowels removed : mdm m dm plural : madam im adams isCapitalized : false containsBlanks : true original string: madamimadam reversed : madamimadam vowels removed : mdmmdm plural : madamimadams isCapitalized : false containsBlanks : false Initial array: { The quick brown fix jumped over the lazy brown dog. Hello world! CISC 1115 is and introduction to Java just... some ... words madam im adam madamimadam } Sorted : { CISC 1115 is and introduction to Java Hello world! The quick brown fix jumped over the lazy brown dog. just... madam im adam madamimadam some ... words }Notes:
String reverse(String s)
, boolean hasBlank(string s)
isVowel
method to make your vowel-removing method cleaner
compareTo
method instead of >, or <.
nextLine
to position the scanner to the next line
for reading the first string of the sequence. (This is the Scanner bug discussed in the text in section 3.10.