New to coding.. So far I have this:
public class Main { public static void main(String[] args) { String sOS1 = stringOfStars("a"); System.out.println(sOS1); String sOS2 = stringOfStars("Hello, world!"); System.out.println(sOS2); String sOS3 = stringOfStars("012345"); System.out.println(sOS3); } static String stringOfStars(String a) { String string = ""; for(int i = 0; i < a.length(); i++) string = string + "*"; return string; // NEED ADDITIONAL CODE HERE } } Additional conditions I need:
- Return a string of 3 asterisks if the character length is LESS than 3.
- Return a string of 10 asterisks if the character length is GREATER than 10.
没有评论:
发表评论