Discourse Community / Genre Assignment Essay

Michael_Java_Rewrite (1)

Step 5:

package step5;

import java.util.Scanner;

public class Step5 {

public static void main(String[] args) {
String city;
Scanner key = new Scanner(System.in);
System.out.print(“Enter in the name of your favorite city: “);
city = key.nextLine();

int stringSize = city.length();
String upper = city.toUpperCase();
String lower = city.toLowerCase();
char letter = city.charAt(0);

System.out.println(“Number of Characters in the city name:” + stringSize
+” \n The city name in all uppercase:”+ upper +
“\n The city name in all lowercase:”+ lower +
“\n The first character in the name of the city:” + letter);

}
}

Leave a Reply