Basically what i need to do is create a program which asks the user to enter their name which then displays the character length of the name which then converts the name into uppercase letter and finally print the name with the first character taken away then the first and second character taken away and so forth. I have been asked to do this using a loop and so far i'm certain a for loop is the ideal choice but i really am not sure how to implement the characters of the word into the loop, this is what i've managed to do so far:
import java.util.Scanner; public class NameLength { public static void main (String[]args) { Scanner scan = new Scanner(System.in); System.out.println("Enter your name:"); String name = scan.nextLine(); System.out.println("Name Entered: " + name); int length = name.length(); System.out.println("Your name contains " + length + " characters"); String capitals = name.toUpperCase(); System.out.println("Your name in uppercase: " + capitals); int length2 = capitals.length(); System.out.println("Your name contains " + length2 + " characters"); char firstLetter = name.charAt(0); for } }
I've looked through all the lecture notes for loops but just can't seem to figure it out, any hints will be much appreciated