I'm new to java programming and I have been reading a java how to book. At the end of each chapters there are challenges and one of the challenges was to:
"Write an application that reads in a user's sentence of unknown, possibly mixed upper and lowercase letters, capitalizes the first letter of the sentence, makes all other letters lowercase, and makes sure there is a period at the end of the sentence."
Can you tell me if this code fits the description above?
/*
* MGramChecker
*/
import java.io.*;
public class MGramChecker {
public static void main(String args[]){
String userSent = " ";
String corrSent = " ";
read = BufferedReader(new InputStreamReader(System));
System.out.print("What's your sentence you need corrected?");
try {
userSent = reader.readLine();
}
catch (IOException ioe) {
System.out.println("I/O Exception Occured");
}
corrSent = userSent.toUpperCase(charAt(0)) + userSent.toLowerCase(charAt(1-....));
//See the line above. Its suppose to take the user's sentence. Then go to the first character and put it
// in upper case. Then its suppose to take the rest of the sentence and put it in lower case.
System.out.println("Here is your corrected sentence:" + corrSent + ".");
System.out.println("Your Welcome");
}
}
Obviously I'm not going to color those two lines red, but that's really what I have questions with. Thanks for the help.