Hey could somone help me with this computer science problem?
Here's the problem:
"Write a method called printStrings that accepts a String and a number of repetitions as parameters and prints that String the given number of times. For example, the call:
printStrings("abc", 5);
will print the following output:
abcabcabcabcabc"
Here's what I have so far:
"public String printStrings(String str, int number){
for(int i = 1; i <= number; i++){
System.out.println(str.length());
}
}"
Here's the error message I'm getting:
"Your code did not compile. Please read and correct the errors below.
•
Line 6
Your method must return a value. If your method has multiple paths of execution (such as if/else statements), every path must contain a return statement. Also beware of nested if/else statements that end with an 'else if'.
missing return statement}
^
1 error"
I'm not sure why it's asking for a return statement when in the instructions it wants me to print of the string. Could someone help?