All pastes #808076 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-12-07 07:14 UTC
rendered paste body
//Name: Joshua Wallace
//School: Clover Park High School
//Project: String practice for week 13
 
public class stringpractice {
    
    public static void main(String[] args) 
    {
    	firstquestion();
    	secondquestion();
    	thirdquestion();
    	fourthquestion();
    	fifthquestion();
    }
    	
    public static void firstquestion()
    {
	String word = "(Question 1) going to win";System.out.println(word);
	}	
   	
   	public static void secondquestion()
   	{
    String word = "Washington";
    System.out.println("(Question 2)" +word + " becomes " + new StringBuffer(word).reverse());
 	}
 	
 	public static void thirdquestion()
 	{
 	 
 	String phrase = ("WazzUp ? - Who's On FIRST ??? - IDUNNO");
 	phrase = phrase.toLowerCase(); //since the phrase has upper and lower case, it needed to be converted to one or the other
 		int count = 0;
 		
 		for (int cycle = 0; cycle < phrase.length(); cycle++)
 		{
 			char v = phrase.charAt(cycle);
 			if (v=='a'|| v=='e'|| v=='i'|| v=='o'|| v=='u')
 			{
 			count++;
 			}
 		}
 		System.out.println("(Question 3) Number of vowels = " +count);
 	}
 	
 	public static void fourthquestion()
 	{
 	String word = "George Washington";
 	word = word.toLowerCase(); //same reason, made lowercase to find the substrings
 	int count = 0;
 	
 	if (word.contains("ton"))
 	{
 		count++;
 	} 
 	if (word.contains("wish"))
 	{
 		count++;
 	}
 		System.out.println("(Question 4) Times substrings were found: " +count);
 	}
 	
 	public static void fifthquestion()
 	{
 	String[] phrase = "We the people of the United States in order to form a more perfect union";
 	
 
 		
 		
 	}
 		
 	
 	
 	}