To keep it short and concise I'm attempting to write a program that not only turns user input into a title. but also prints out a user generated decorative underline beneath the output. example;
"prompt to get user input"
input: i am a title, *
output:
I Am A Title
* ** * *****
I was thinking of using a method that receives a String and a char and uses that to calculate the number of chars it has to output. I was already able to get the title to output in capitals thanks to a post here. Now it's just the characters. Even if it's just ways to think about the problem. Any help would be appreciated.
public static void printUnderline(String s, char c){
char[] arr =s.toCharArray();
for(int i=0;i<arr.length;i++)
if(arr[i] == ' ')
System.out.print(' ');
else
System.out.print(c);
}