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 making use of String class's .substring() method.
//@returns a string whose characters have been increased by one and
//bump last letter to front
//example 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 a helper method called isAllAlpha(String str). This method should return true if every character in str is a letter, upper or lower case.
    Hint
  • Make a helper method called isNumeric(String str). This method should return true if every character in str is a number. In addition, can contain, at most, 1 '.'
  • Make sure that the name is at least 2 letters and includes no numbers
  • Make sure that the password is at least 4 characters, contains at least 1 number, 1 lower case letter and 1 upper case letter.. 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 (zip codes have between 3 and 5 digits)
  • make sure that the person was born at reasonable date (not 1820 or this year!)
  • ensure that the phone number is valid (no letters and follows the prescribed format)
Site Map | Resources | Online Math Games | Fraction Games Online | TOS