Java Strings Programming Projects Student Labs

[ Home] [ Site Map ]

Links:




String Manipulation

Moderate Difficulty


OffsetByOne project Create a method that offsets each letter in a String by one to the right. See the example code below. To get a perfect on this you must research and take advantage of the String classes's .toCharArray() method. This method creates an array of chars (char[]) from a string. It's probably easier to do this with a loop and makign use of String class's .substring() method.
//@returns a string whose characters have been increased by one and
//bump last letter to front
//exampel input and output
	// input		output
	//abc			cab
	//abcdef		fabcde
	public String offsetByOne (String str)
Palindrome Project Make the program below function
//@returns true if parameter is a palindrome;
boolean isPalindrome(String potentialPalindrome(){
return false;
}

Validate User Input Project The right is a screen shot of this project. Your job is to validate that the user has entered his or her information. (ValidateForm Source Code )
  • Make sure that the name is at least 2 letters
  • Make sure that the password is at least 4 characters. Also, don't let the user's password be the same as his or her name
  • the email must include an @ as well as a "." and the "." must come after the "@"
  • the zip code must be all numbers and be the right length
  • make sure that the person was born at reasonable date (not 1820 or this year!)
  • ensure that the phone number is valid
site map | resources