ControlFlow.

java
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
’z’};
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:

spawrks 09/18/14

1-1/2(1)

package com.delta.controlflow;
import android.util.Log;
/**
* Created by learnovate on 2/27/14.
*/
public class ControlFlow {
char[] alphabet = {’a’,’b’,’c’,’d’,’e’,’f’,’g’,’h’,’i’,’j’,’k’,’l’,’m’,’n’,’o’,’p’,’q’,’r’,’s’,’t’,’u’,’v’,’w’,’x’,’y’,

//English-language pangram tester
//"Pack my box with five dozen liquor jugs."
//"Mr. Jock, TV quiz PhD, bags few lynx."
//"The quick red fox jumps over the lazy brown dog""
public void start(){
char[] sentenceToTest = toCharacterArray("The quick red fox jumps over the lazy brown dog");
char[] missingLetters = new char[26];
//start here!

// Find out if the ’sentenceToTest’ is in fact a pangram.
// then make a "writeSuccess" method call with the following pieces of data:
// 1. number of missing letters (if any)
// 2. which letters (if any)
// 3. the original sentence
//writeSuccess(int aNumMisssing, char[] aMissingLetters, char[] aSentence )

}

//
// This code is just to help us write easier to read code

valueOf(aSentence)).e("OPERATOR". for (int i = 0. Log. } public void writeSuccess(int aNumMisssing.String. } 1-2/2(2) . char[] aMissingLetters.’n’. i < s.’e’.’e’} // public char[] toCharacterArray(String s) { if (s == null) { return null. } char[] array = new char[s. i++) { array[i] = s. char[] aSentence ){ Log.e("OPERATOR". } public void writeToLog(int output){ Log."testing sentence:" + String.’c’.’n’.valueOf(output)).’e’.java 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: } spawrks 09/18/14 // it turns "sentence" into a char array of {’s’.’t’.message). String message = String.length()].valueOf(output)).charAt(i).length(). } public void writeToLog(String output){ Log.valueOf(aMissingLetters).String.e("OPERATOR".e("OPERATOR".ControlFlow. } return array.valueOf(aNumMisssing) + " missing:" + String.

getMenuInflater(). if (id == R.MenuItem. return true. } return super.inflate(R. menu).activity_control_flow). setContentView(R.java 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: spawrks 09/18/14 package com.control_flow. this adds items to the action bar if it is present. ControlFlow cf = new ControlFlow().onOptionsItemSelected(item).start(). } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu.id. } } 2-1/1(3) .getItemId().delta. android.layout. cf.Bundle.Activity.view.ControlFlowActivity.app.xml.Menu. int id = item.controlflow.menu. import import import import android. so long // as you specify a parent activity in AndroidManifest.os. public class ControlFlowActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super. android. android.view. } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here.action_settings) { return true.onCreate(savedInstanceState). The action bar will // automatically handle clicks on the Home/Up button.

java 1 pages 39 lines 14/03/01 19:57:55 -1/1(4) .Table of Contents spawrks 09/18/14 1 controlflow/src/main/java/com/delta/controlflow/ControlFlow.java 2 pages 79 lines 14/03/17 20:34:16 2 controlflow/src/main/java/com/delta/controlflow/ControlFlowActivity.