notes intro/old submit AP Problems the dump links
  for and while assignments

Create a class called: ForWhileAssignments (starter code below)

1a. Create a method chalkBoardFor() that will print "I will not make pointless loops" 50 times (using a for loop):
1b. Create a method chalkBoardWhile() that will print "I will not make pointless loops" 50 times (using a while loop):
2. Create a method findFactors(int x) that will print out all the factors of a number:
ie findFactors(24) would print out
3. Create a method called String findPassword() that will use the included method readString (that reads from the users input) and keep asking the user for a password until it has between 6 and 8 letters and it will return that password.
4. Create a method called public void pyramid(int rows) that will print a pyramid like below with the number of rows specified

5. Create a method cheerLeader that will take in a word (say Jacob) and then say give me a J give me a A! give me a C!

6. Advanced2: Create a method splitWords(String phrase) that will take in a phrase (say "The dog is green") would give






ec: create a method called String findSecurePassword() that will use the readString and keep asking the user for a password until it has between 6 and 8 characters, with atleast 1 number in it and at least 1 letter; it will return that password. For real extra credit make it use capital and lower case letters and any extra checks you can think of. For full credit, use your method findPassword() above.

ec2: create an efficient method to determine if a number is prime

ec2b: print out all the primes you can, starting at 2 (of course using your method above)Time it - fastest algorithm wins!

import java.util.Scanner;

public class ForWhileAssignments {

	public void chalkBoardFor()


	public void chalkBoardWhile()


	public void findFactors(int x)


	public String findPassword()
        //an example of asking the user for a password and reading it in using the included method
        System.out.println("Enter a password");
        String password=readString();
		return "";

	public void pyramid(int rows)


    public void cheerLeader(String word)
    public void splitWords(String phrase)

	 * This method will read in what the user has typed as a string
	 * @return The inputted string
	public String readString()
		Scanner scan=new Scanner(System.in);
		String theInputtedString=scan.nextLine();
		return theInputtedString;

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		ForWhileAssignments f=new ForWhileAssignments();
		System.out.println("Your password is "+f.findPassword());

    //Will find the sum of every third number starting at begin going to end
    // ie if they say findSumThirds(5,12,3) it would do 5,8,11, and return 24
    public int findSumThirds(int begin, int end)
    	return 0;
    //Ask the users for input and will find the average of those numbers until they type -1
    //ie findAvg, user puts in 5,8,7,-1,  it should return 20/3 or 6.6666666667
    public double findAvg()
    	 System.out.println("Enter numbers and I will , type -1");
         int inputNum=Integer.parseInt(readString());
         return 0;