// IntExample1
int x;
x = 5;
System.out.println(x);


// IntExample2
int x = 5;
System.out.println(x);


// AddIntExample
int x = 5;
System.out.println(x);
x = 5 + 20;
System.out.println(x);


// FloatExample2
float price = (float) 7.25 * 5;
System.out.println(price);


// DoubleExample
double val1 = 7.0 / 9.0;
double val2 = 2.0 / 9.0;
double val3 = val1 + val2;
System.out.println(val1);
System.out.println(val2);
System.out.println(val3);


// CharExample
char letter = 'a';
System.out.println(letter);



// BooleanExample
boolean value = true;
System.out.println(value);


// ApplesOrangesExample
float apples = (float) 10.0;
//int oranges = apples;		// Incorrect
int oranges = (int) apples;	// Correct

// MulderScullyExample
int mulder = 10;
int scully = 15;
System.out.println(mulder);
System.out.println(scully);
int tmp = scully;
scully = mulder;
mulder = tmp;
System.out.println(mulder);
System.out.println(scully);


// BattingAverageExample
int hits = 40;
int atBats = 100;
double battingAverage = (double) hits / (double) atBats;
System.out.println(battingAverage);


// GeorgeWashingtonExample
String firstName = "George";
String lastName = new String("Washington");
System.out.println(firstName);
System.out.println(lastName);
String fullName = firstName + lastName;
System.out.println(fullName);
fullName = firstName + " " + lastName;
System.out.println(fullName);



// GetRichQuickExample
String title = "Get Rich Quick by Writing Java Books";
int len = title.length();
System.out.println(len);



// GetRichQuickExample2
String title = "Get Rich Quick by Writing Java Books";
int index = title.indexOf("Rich"); 
System.out.println(index);



// GetRichQuickExample3
String title = "Get Rich Quick by Writing Java Books";
String firstHalf = title.substring(0, 18);
String lastHalf = title.substring(18);
System.out.println(firstHalf);
System.out.println(lastHalf);



// UseTheForceExample
String force = "Use the force, Luke!";
String key = "Luke";
int index = force.indexOf(key);
System.out.println("Found key at " + index);




// RochelleExample
String name = new String("Rochelle");
System.out.println("Hello, my name is " + name);



// QuickBrownFoxExample
String str1 = "The quick brown fox";
String str2 = "jumped over";
String str3 = "the lazy dogs.";
int len = str1.length();
System.out.println("Length of '" + str1 + "' is " + len);
len = str2.length();
System.out.println("Length of '" + str2 + "' is " + len);
len = str3.length();
System.out.println("Length of '" + str3 + "' is " + len);




// UseTheForceExample2
String force = "Use the force, Luke!";
String subStr = force.substring(15, 19);
System.out.println("Substring is " + subStr);



// UseTheForceExample3
String force = "Use the force, Luke!";
String findString = "Luke";
int findStringLength = findString.length();
int startIndex = force.indexOf(findString);
int endIndex = startIndex + findStringLength;
String subStr = force.substring(startIndex, endIndex);
System.out.println("Substring is " + subStr);




// IntArrayExample
int firstArray[];
int secondArray[] = new int[10];
int thirdArray[] = {10, 12, -10, 100};
System.out.println(thirdArray[0]);
System.out.println(thirdArray[1]);
System.out.println(thirdArray[2]);
System.out.println(thirdArray[3]);




// CharArrayExample
char letters[] = { 'a', 'b', 'c' };
System.out.println(letters.length);




// BranJeffKateExample
String names[] = { "Jeffrey", "Brandon", "Katelyn" };
String children[] = new String[3];
children[0] = names[0];
children[1] = names[1];
children[2] = names[2];
System.out.println(children);




// VectorExample
Vector v = new Vector();
String s = new String("Hello");
v.add(s);
v.add("Goodbye");
System.out.println(v);
System.out.println(v.size());
boolean success = v.remove(s);
System.out.println(v);
System.out.println(success);
System.out.println(v.size());




// IntegerExample
Integer I = new Integer(2112);
int i = I.intValue();
System.out.println(I);
System.out.println(i);




// JohnBigbootyExample
String name = new String("John Bigbooty");
Integer age = new Integer(30);
Double salary = new Double(82312.44);
Vector record = new Vector();
record.add(name);
record.add(age);
record.add(salary);
System.out.println(record);




// RamboFiestyExample
Vector dogs = new Vector();
dogs.add("Rambo");
dogs.add("Feisty");
Enumeration names = dogs.elements();
System.out.println(names.hasMoreElements());
System.out.println(names.nextElement());
System.out.println(names.hasMoreElements());
System.out.println(names.nextElement());
System.out.println(names.hasMoreElements());



// IsLowerCaseExample
char letter = 'f';
boolean lowerCase = Character.isLowerCase(letter);
System.out.println("Is letter lower case? " + lowerCase);



// ThreeStoogesExample
Vector stooges = new Vector();
stooges.add("Larry");
stooges.add("Curly");
stooges.add("Moe");
stooges.remove("Curly");
stooges.add("Shemp");
System.out.println("The " + stooges.size() + " Stooges");
Vector actors = new Vector();
actors.add("Bob");
actors.add("Ted");
actors.add("Alice");
actors.add(stooges);
System.out.println(actors.size());
System.out.println(actors);




// DisastersExample
Vector disasters = new Vector();
disasters.add("earthquake");
disasters.add("flood");
disasters.add("tornado");
disasters.add("macarena");
Enumeration e1 = disasters.elements();
String disastersArray[] = new String[disasters.size()];
disastersArray[0] = (String) e1.nextElement();
disastersArray[1] = (String) e1.nextElement();
disastersArray[2] = (String) e1.nextElement();
disastersArray[3] = (String) e1.nextElement();
System.out.println("disasters Vector = " + disasters);
System.out.println("disastersArray = " + disastersArray);


