P4_HardyTrent_C12_front5.java
/* Given a String, we'll say that the front is the first 5 chars of the String.
	 * If the string length is less than 5, the front is whatever is there
	 * Return a new String which is 3 copies of the front.
	 * front5("Coding") becomes "CodinCodinCodin"
	 * front5("And") becomes "AndAndAnd"
	 * front5("KleinCollins") becomes "Klein"
	 * front5("HardyTrent") becomes "HardyHardyHardy"	// Replace my name with yours
	 * Note: I moved main to the bottom of the code. */
Given a String, we'll say that the front is the first 5 chars of the String.
If the string length is less than 5, the front is whatever is there
Return a new String which is 3 copies of the front.
Given a String we ' ll say that the front is the first 5 chars of the String . If the string length is less than 5 the front is whatever is there Return a new String which is 3 copies of the front .
static String front5(String str) {
		String front;
		if (str.length() >= 5) {
		  front = str.substring(0,5);
		}
		else {
		   front = str;
		}
		return front + front + front;
	      }
static String front5 ( String str ) { String front ; if ( str . length ( ) >= 5 ) { front = str . substring ( 0 , 5 ) ; } else { front = str ; } return front + front + front ; }
Given a String, we'll say that the front is the first 5 chars of the String.
Given a String we ' ll say that the front is the first 5 chars of the String .