Question: Task 4: Pad String Write a method called padstring that acrepts two parameters a string and an integer representing a length. The method should pad
Task 4: Pad String Write a method called padstring that acrepts two parameters a string and an integer representing a length. The method should pad the parameter string with spaces of the given length. For example padString("hello", 8) should print" hello". Since hello is only 5 characters-we need to pad it with 3 spaces to get it to be 8 in length f the strings length is already as long as the parameter, your method should print he orginal padString("congratulations". 15) should print congratulations" there is no padding because there are 15 letters in congratulations." Complete the program by having the main method th console. at call padStcingc) with the values from the above and prints the results to the Output: hello congratulations
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
