/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/Finale.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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Random; 
import java.util.Scanner; 
public class Finale { 
public static void main(String[] args) { 
int crash = 0; 
// Introduction is outside the loop so it doesn't repeat when you fail. 
introduction.introductionking(); 
while (crash != 1) { 
crash = 0; 
try { 
Finale.finaleKing(args); 
crash++;//kills the program 
} catch (Exception e) { 
System.out.println("Please enter the number of the road you wi" 
+ "sh to travel down."); 
} 
} 
} 
public static void finaleKing(String[] args) { 
Scanner in = new Scanner(System.in); 
int option, scan, randomNum, choosenum; 
int loopkill = 0; 
while (loopkill != 1) { 
scan = 0; 
Random rn = new Random(); 
int n = 15 - 2 + 1; 
int i = rn.nextInt() % n; 
randomNum = 1 + i; 
choosenum = Math.abs(randomNum); 
if (choosenum == 0) { 
choosenum++; 
} 
System.out.println("You have 6 roads infront of you."); 
System.out.println("1: The first road leads to the land of" 
+ " variable knowledge."); 
System.out.println("2: The second road leads to the town hall " 
+ "where the king conducts his operations."); 
System.out.println("3: The third road leads to the land of " 
+ "'arithmos' meaning arithmetic in greek."); 
System.out.println("4: The fourth road leads to our water sourc" 
+ "e, they control the flow of resources for the land." 
+ ""); 
System.out.println("5: The fifth road leads to the circus, many" 
+ " fun rides there, they just go in circles till you " 
+ "stop them."); 
System.out.println("6: This road leads to the dark brotherhood" 
+ ", they are assassins, their methods are...." 
+ " questionable."); 
System.out.println("7: This road leads to the library, their " 
+ "most famous book is The Catcher In The Try. I feel " 
+ "like I said that wrong."); 
System.out.println("8: This road leads to a starship that's the siz" 
+ "e of a small class 4 moon, we call it, The Death Star."); 
1.1 of 4 2014.12.03 15:28:22
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/Finale.java 
System.out.println("9: This leads to a pirate ship that is enhabite" 
+ "d by 80's people. They constantly spout out: 'Arr... eee" 
+ "ey!'"); 
System.out.println("10: Your grandad died, he left you some inherit" 
+ "ance, go down this road to receive your inheritance."); 
System.out.println("11: Your being taxed and need to go to the coll" 
+ "ections office, sorry. follow this road to pay your bill" 
+ "s."); 
System.out.println("12: This leads to the farms, best known for sow" 
+ "ing strings to make fabric."); 
System.out.println("13: This leads to the other road, we don't talk" 
+ " about it, it's weird."); 
System.out.println("14: Random."); 
System.out.println("15: Or you may turn around and go home."); 
System.out.println("Which road do you chose? Enter a number."); 
option = in.nextInt(); 
if (option == 14) { 
option = choosenum; 
} 
if (option == 1) { 
while (scan != 1) { 
try { 
variableSection.variableking(); 
scan++; 
} catch (Exception e) { 
System.out.println("Please enter a number."); 
} 
} 
} else if (option == 2) { 
while (scan != 1) { 
try { 
operations.operationsKing(); 
scan++; 
} catch (Exception e) { 
System.out.println("Please enter a number."); 
} 
} 
} else if (option == 3) { 
while (scan != 1) { 
try { 
arithmatic.arithmaticKing(); 
scan++; 
} catch (Exception e) { 
System.out.println("Please enter a number."); 
} 
} 
} else if (option == 4) { 
while (scan != 1) { 
try { 
flowControl.flowControlKing(); 
scan++; 
} catch (Exception e) { 
System.out.println("Please enter a number."); 
} 
} 
} else if (option == 5) { 
while (scan != 1) { 
try { 
loops.loopKing(); 
scan++; 
} catch (Exception e) { 
System.out.println("Please enter a number."); 
} 
} 
} else if (option == 6) { 
while (scan != 1) { 
try { 
methods.methodKing(); 
scan++; 
2.1 of 4 2014.12.03 15:28:22
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/Finale.java 
scan++; 
} catch (Exception e) { 
System.out.println("Please enter a number."); 
} 
} 
} else if (option == 7) { 
while (scan != 1) { 
try { 
tryNCatch.tryNCatchKing(); 
scan++; 
} catch (Exception e) { 
System.out.println("Please enter a number."); 
} 
} 
} else if (option == 8) { 
while (scan != 1) { 
try { 
classes.classesKing(); 
scan++; 
} catch (Exception e) { 
System.out.println("Please enter a number."); 
} 
} 
} else if (option == 9) { 
while (scan != 1) { 
try { 
arrays.arraysKing(); 
scan++; 
} catch (Exception e) { 
System.out.println("Please enter a number"); 
} 
} 
} else if (option == 10) { 
while (scan != 1) { 
try { 
inheritance.interitanceKing(); 
scan++; 
} catch (Exception e) { 
System.out.println("Please enter a number"); 
} 
} 
} else if (option == 11) { 
while (scan != 1) { 
try { 
collections.collectionsKing(); 
scan++; 
} catch (Exception e) { 
System.out.println("Please enter a number"); 
} 
} 
} else if (option == 12) { 
while (scan != 1) { 
try { 
strings.stringsKing(); 
scan++; 
} catch (Exception e) { 
System.out.println("Please enter a number"); 
} 
} 
} else if (option == 13) { 
while (scan != 1) { 
try { 
misc.miscKing(); 
scan++; 
} catch (Exception e) { 
System.out.println("Please enter a number"); 
} 
} 
// to kill the loop, this is the only way to end the program 
} else if (option == 15) { 
System.out.println("You decide you've had enough traveling" 
+ " for one day, you return home to go to bed."); 
loopkill = 1; 
3.1 of 4 2014.12.03 15:28:22
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/Finale.java 
loopkill = 1; 
} else { 
System.out.println("Invalid entry, please try again."); 
} 
} 
} 
} 
4.1 of 4 2014.12.03 15:28:22
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/addingFiveIntegers.java 
1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
28 
29 
30 
31 
32 
33 
34 
35 
36 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class addingFiveIntegers { 
public static void addingFiveIntegersKing() { 
int total = 0; // stores the sum of the 5 numbers 
int number; // stores the current input 
Scanner scan = new Scanner(System.in); 
int a = 1; // limits loop to 5 
while (a <= 5) {// limits loop to 5 
System.out.print("Say a number please "); 
number = scan.nextInt(); 
total = total + number; 
a++; // This only exists to limit the loop to 5 
} 
System.out.println("The total is: " + total); 
} 
} 
1.1 of 1 2014.12.03 15:00:24
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/areaOfCircle.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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class areaOfCircle { 
// Constant PI is defined at the class level 
static final double PI = Math.PI; 
public static double radius, area; 
void getArea() { 
// Method used to calculate area of a circle 
final Scanner sc = new Scanner(System.in); 
System.out.println("Assassin: 'Give him a radius, make him calculate " 
+ "the area of the circle in his head'"); 
radius = sc.nextDouble(); 
area = PI * radius * radius; // equation of area of circle 
System.out.println("Man: The area of circle is: " + area); 
} 
public static void areaOfCircleKing() { 
areaOfCircle c1 = new areaOfCircle();//calls the calculations 
c1.getArea(); 
} 
} 
1.1 of 1 2014.12.03 14:53:14
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 
34 
35 
36 
37 
38 
39 
40 
41 
42 
43 
44 
45 
46 
47
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/areaOfCircleAgain.java 
73 
74 
75 
76 
77 
78 
79 
80 
81 
82 
83 
84 
}; 
circle1.setradius(radius); 
circle1.toString(); 
return "Radius " + radius + " and Area is " + area; 
} 
} 
} 
2.1 of 2 2014.12.03 14:43:10
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/arithmatic.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 
40 
41 
42 
43 
44 
45 
46 
47 
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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class arithmatic { 
public static void arithmaticKing() { 
Scanner in = new Scanner(System.in); 
int problem = 0; 
int scan = 0; 
System.out.println("You enter the greak kingdome of arthimos, which jus" 
+ "t turns out to be a pillow fort."); 
System.out.println("The 10 year old king adresses you"); 
System.out.println("King: 'Hello loyal subject, I am having trouble wit" 
+ "h the homewrok issued by the dreadded"); 
System.out.println("Ms. Burns. I command your help'"); 
System.out.println("He hands you a piece of paper with problems on it. " 
+ "You look at him confused."); 
System.out.println("King: 'We are not allowed to cheat so I ask you to " 
+ "provide me with examples and solutions'"); 
while (problem != 4) { 
scan = 0; 
System.out.println("Which type of problem do you wish to help him w" 
+ "ith?"); 
System.out.println("1: absolute value, 2:rounding up and down, 3: q" 
+ "uadratic root or 4: leave?"); 
problem = in.nextInt(); 
switch (problem) { 
case 1: 
while (scan != 1) { 
try { 
absValue.absValueKing(); 
System.out.println("The young king thanks you and y" 
+ "ou leave Arithmos the greatest pillow f" 
+ "ort the worlds ever seen."); 
scan++; // ends loop 
} catch (Exception e) { 
System.out.println("Please enter a number"); 
} 
} 
break; 
case 2: 
while (scan != 1) { 
try { 
upOrDown.upOrDownKing(); 
System.out.println("The young king thanks you and y" 
+ "ou leave Arithmos the greatest pillow fo" 
+ "rt the worlds ever seen."); 
scan++; // ends loop 
} catch (Exception e) { 
System.out.println("Please enter a number"); 
} 
} 
break; 
case 3: 
while (scan != 1) { 
try { 
quadRoot.quadRootKing(); 
System.out.println("The young king thanks you and y" 
+ "ou leave Arithmos the greatest pillow fo" 
1.1 of 2 2014.12.03 15:14:50
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/arithmatic.java 
73 
74 
75 
76 
77 
78 
79 
80 
81 
82 
83 
84 
85 
+ "ou leave Arithmos the greatest pillow fo" 
+ "rt the worlds ever seen."); 
scan++; // ends loop 
} catch (Exception e) { 
System.out.println("Please enter a number"); 
} 
} 
break; 
} 
} 
} 
} 
2.1 of 2 2014.12.03 15:14:50
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/arithmeticOperations.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 
40 
41 
42 
43 
44 
45 
46 
47 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class arithmeticOperations { 
public static void arithmeticOperationsKing() { 
int a, b; 
int resulta, results, resultm; 
double resultd; 
Scanner in = new Scanner(System.in); 
System.out.println("How many times do you wish to bark the first " 
+ "time?"); 
a = in.nextInt(); 
System.out.println("How many times do you wish to bark the second " 
+ "time?"); 
b = in.nextInt(); 
resulta = a + b; // addition 
results = a - b; // subtraction 
resultm = a * b; // multiplication 
resultd = (double) a / b; //division 
System.out.print("The dog barks back " + resulta); 
System.out.println(" times, this is clearly the result of addition"); 
System.out.print("The dog barks back " + results); 
System.out.println(" times, this is clearly the result of subtraction"); 
System.out.print("The dog barks back " + resultm); 
System.out.println(" times, this is clearly the result of " 
+ "multiplication"); 
System.out.print("The dog barks back " + resultd); 
System.out.println(" times, this is clearly the result of subtraction"); 
} 
} 
1.1 of 1 2014.12.03 15:20:17
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/arithmeticOperations2.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 
40 
41 
42 
43 
44 
45 
46 
47 
48 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class arithmeticOperations2 { 
public static void arithmeticOperations2King() { 
Scanner in = new Scanner(System.in); // in because patterns 
int sum, diff, product, quotient; //much more compact. 
System.out.println("How mnay times would you like to jump the first " 
+ "time?"); 
int num1 = in.nextInt(); 
System.out.println("How many times would you like to jump the second " 
+ "time?"); 
int num2 = in.nextInt(); 
sum = num1 + num2; 
diff = num1 - num2; 
product = num1 * num2; 
quotient = num1 / num2; 
System.out.print("The ball bounces " + sum); 
System.out.println(" times, this is clearly the result of addition"); 
System.out.print("the ball bounces " + diff); 
System.out.println(" times, this is clearly the result of subtraction"); 
System.out.print("The ball bounces " + product); 
System.out.println(" times, this clearly is the result of subtraction"); 
System.out.print("The ball sits quietly and then freaks out bouncing " 
+ "off the walls " + quotient); 
System.out.println(" times ending with smacking you in the head."); 
System.out.println("The ball clearly doesnt like the number " 
+ quotient); 
} 
} 
1.1 of 1 2014.12.03 15:20:18
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/arrays.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 
40 
41 
42 
43 
44 
45 
46 
47 
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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class arrays { 
public static void arraysKing() { 
Scanner in = new Scanner(System.in); 
int arraychoice = 0, scan; 
System.out.println("You walk up to the pirate ship and see a pirate" 
+ "."); 
System.out.println("Pirate: 'Arr ye matey! If ye with entry thy must wa" 
+ "lk the plank!'"); 
System.out.println("You get cautious but then you see that the entrance" 
+ "to the pirate ship is just a plank of wood. You cross it."); 
System.out.println("Pirate: 'Arr good job laddeh, you passed the first" 
+ " test.'"); 
System.out.println("Pirate: 'There be 3 other tests, ye may come and " 
+ "go as ye please."); 
System.out.println("Pirate: 'Ye can go to the school where we teach th" 
+ "e youngins.'"); 
System.out.println("Pirae: 'Ye can go to the playin' station where we b" 
+ "e playin' Liar's dice.'"); 
System.out.println("Pirate: Or ye can go and see the fortune teller."); 
while (arraychoice != 4) { 
scan = 0; 
System.out.println("Where would you like to go?"); 
System.out.println("1:The school, 2:The game, 3:The fortune teller," 
+ " or 4:Leave?"); 
arraychoice = in.nextInt(); 
switch (arraychoice) { 
case 1: 
while (scan != 1) { 
try { 
System.out.println("You walk through a door and fin" 
+ "d a teacher and a bunch of kids sitting " 
+ "at desks."); 
System.out.println("Pirate: 'Ay good, we got us a l" 
+ "ive one kids!'"); 
System.out.println("The kids cheer and bang on thei" 
+ "r desks loudly."); 
System.out.println("Pirate: 'Okay settle down ye mo" 
+ "nsters. Greeting boy, we want to as a fa" 
+ "vor of ya.'"); 
System.out.println("You notice and pistol in his po" 
+ "cket and nod."); 
arraySum.arraySumKing(); 
System.out.println("Pirate: 'Thank ye boy, you may " 
+ "go.'"); 
scan++; //kills loop 
} catch (Exception e) { 
System.out.println("Please enter numbers only."); 
} 
} 
break; 
case 2: 
while (scan != 1) { 
try { 
System.out.println("Jones: 'Oh, what fortuitous cer" 
+ "cumstances be this, a crew member i have" 
+ " yet to lay my eyes on. A piece of, fres" 
+ "h meat.'"); 
1.1 of 2 2014.12.03 14:33:18
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/arrays.java 
73 
74 
75 
76 
77 
78 
79 
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
91 
92 
93 
94 
95 
96 
97 
98 
99 
100 
101 
102 
103 
104 
105 
106 
107 
108 
109 
110 
111 
112 
113 
114 
115 
116 
117 
118 
119 
+ "h meat.'"); 
System.out.println("You try to back away but two me" 
+ "n now gaurd the doors."); 
System.out.println("Jones: 'Oh my scared friend, no" 
+ " need to run, I just want to play a quic" 
+ "k game."); 
System.out.println("You nod and try to get done as " 
+ "fast as possible."); 
evenOnly.evenOnlyKing(); 
System.out.println("You nod and leave."); 
scan++; //kills loop 
} catch (Exception e) { 
System.out.println("Please enter numbers only."); 
} 
} 
break; 
case 3: 
while (scan != 1) { 
try { 
System.out.println("You enter the room and a lovely" 
+ " woman greets you."); 
System.out.println("Woman: 'Oh hello there darlin, " 
+ "just sit down and i'll tell your fortune" 
+ "'"); 
System.out.println("You sit in the chair and for th" 
+ "e first time you aren't scared."); 
smallXLarge.smallXLargeKing(); 
System.out.println("You smile, thank the woman and " 
+ "walk out of the room."); 
scan++; //kills loop 
} catch (Exception e) { // possible death scenario 
System.out.println("woman: 'YOU BRAT! I SAID GIVE M" 
+ "E NUMBERS AND YOU DID THIS! I guess you " 
+ "want to die."); 
System.out.println("The woman stabs you and cuts ou" 
+ "t your heart"); 
System.out.println("This is what happens when you d" 
+ "ont follow directions, go back and try a" 
+ "gain."); 
} 
} 
} 
} 
} 
} 
2.1 of 2 2014.12.03 14:33:18
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/arraySum.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 
40 
41 
42 
43 
44 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class arraySum { 
public static void arraySumKing() { 
Scanner in = new Scanner(System.in); 
int sum = 0; 
int a[] = new int[10]; // array with 10 values 
System.out.println("Pirate: 'Ok ya wee laddeh, give us 10 numbers for t" 
+ "he wee kids to add.'"); 
// fills the array 
for (int i = 0; i < 10; i++) { 
a[i] = in.nextInt(); 
if (i == 9) { 
break; 
} 
} 
// adds the values of the array 
for (int i = 0; i < 10; i++) { 
sum += a[i]; 
} 
System.out.println("Kids: 'The sum of..'"); 
System.out.println("The pirate teacher places a hand on his pistol"); 
System.out.println("Kids: 'The combined value of ye numbers be " + sum); 
System.out.println("The pirate teacher smiles and nods."); 
} 
} 
1.1 of 1 2014.12.03 14:33:01
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/boxOfNumbers.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 
40 
41 
42 
43 
44 
45 
46 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class boxOfNumbers { 
public static void boxOfNumbersKing() { 
Scanner in = new Scanner(System.in); 
System.out.println("Clown: 'What's your height?'"); 
int height = in.nextInt(); 
System.out.println("Clown: 'And your width?'"); 
int width = in.nextInt(); 
int col; // collums 
int row = 1; // rows 
System.out.println("The clown claps his hands and"); 
// this will later be used to multiply matricies together 
while (row <= height) { 
System.out.println(""); 
row++; 
col = 1; 
while (col <= width) { 
System.out.print("#"); 
col++; 
} 
} 
System.out.println(""); 
System.out.println("appears in the air"); 
} 
} 
1.1 of 1 2014.12.03 15:03:30
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/challenge.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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
public class challenge extends iEquals3 { // gets all them operations 
void iEquals3King() { 
iEquals3 equal = new iEquals3(); 
for (int j = 0; j < 3; j++) { 
equal.increment(); 
} 
equal.print(); 
} 
} 
1.1 of 1 2014.12.03 14:17:52
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/chooseANumber.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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
class chooseANumber { 
public static void chooseANumberKing() { 
Scanner in = new Scanner(System.in); 
System.out.println("Negeki: 'Have you guessed the number?'"); 
int input = in.nextInt(); 
try { 
// checks if the number is divisable by both 5 and 2 
if (input % 5 == 0 && input % 2 == 0) { 
System.out.println("Negeki: 'correct, thank you, no one ever " 
+ "talks to me'"); 
System.out.println("He vanishes and you walk out of the room"); 
} else { 
throw new NumberFormatException(); 
} 
} catch (NumberFormatException e) { 
System.out.println("Negeki: 'Wrong, thank you for talking to me" 
+ " ever since the accident it seems that everyone avoids" 
+ " me"); 
} 
} 
} 
1.1 of 1 2014.12.03 14:44:33
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/circleColor.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 
40 
41 
42 
43 
44 
45 
46 
47 
48 
49 
50 
51 
52 
53 
54 
55 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
class circleColor { 
public static void circlecolorKing() { 
Scanner in = new Scanner(System.in); // in because patterns 
int sum = 0; 
System.out.println("What is the radius in killometers?"); 
double r = in.nextInt(); 
if (70 <= r && r <= 80) { // actual radius of death star in movies. 
System.out.println("Trooper: 'huh, thats roughly the same size this" 
+ " one is, good choice.'"); 
} 
myCircle user = new myCircle(); 
user.setRadius(r); // making sure the radius is at least 1 
System.out.println("what color should it be?"); 
String col = in.next(); //color is a string 
System.out.println(user.getArea()); // calulate area 
System.out.println(col); // the color 
} 
} 
class myCircle { 
private double radius; 
public void setRadius(double r) { 
if (r > 0) { 
radius = r; 
} else { 
radius = 1; 
} 
} 
public double getArea() { 
double area; 
area = (3.141592653589793) * radius * radius; //pi is a big small number 
return area; 
} 
} 
1.1 of 1 2014.12.03 14:38:54
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/classes.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 
40 
41 
42 
43 
44 
45 
46 
47 
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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class classes { 
public static void classesKing() { 
Scanner in = new Scanner(System.in); 
int classChoice = 0, scan = 0; 
System.out.println("you reach an elivator and get launched into sp" 
+ "ace, after a 20 minute journy the doors open and a man" 
+ "greets you."); 
System.out.println("Grunt: 'hello new recruit, we are here to defe" 
+ "at these enemies of peace called Jedi."); 
System.out.println("Grunt: 'You have two ways to help out here and " 
+ "one relaxation area."); 
while (classChoice != 4) { 
scan = 0; 
System.out.println("Grunt: 'You can go to the 1:Design area, 2:Dar" 
+ "h vader book signing, 3:Targeting area, or 4:Leave."); 
classChoice = in.nextInt(); 
switch (classChoice) { 
case 1: 
while (scan != 1) { 
try { 
System.out.println("You enter the design area and " 
+ "there is a storm trooper there to greet" 
+ "you."); 
System.out.println("Trooper: 'Hello soldier! We are" 
+ " creating more Death Stars in order to h" 
+ "elp the peaceful takeover of the galaxy" 
+ ".'"); 
System.out.println("Trooper: 'We don't want to get " 
+ "them mixed up so we ask you to give us" 
+ "the radius of the deathstar, and the col" 
+ "or.'"); 
circleColor.circlecolorKing(); 
System.out.println("Trooper: 'hm yes good, ok you " 
+ "may go.'"); 
scan++;// kill loop 
} catch (Exception e) { 
System.out.println("Please enter a number"); 
} 
} 
break; 
case 2: 
while (scan != 1) { 
try { 
System.out.println("You enter the room and everyone" 
+ "is standing very worried in a line as lo" 
+ "rd vader was signing their books."); 
System.out.println("You stand in line till you get " 
+ "to the front"); 
nameBookMail.nameBookMailKing(); 
System.out.println("Vader: 'You should check out my" 
+ " new book 'fear and trembling.'"); 
System.out.println("He hands you a book titled fear" 
+ " and trembling. At the bottom where it s" 
+ "ays who the author is, the name Johannes" 
+ " de silentio is crossed out, and Anakin " 
+ "skywalker is written in sharpie."); 
System.out.println("You ask him if he actually wrot" 
1.1 of 2 2014.12.03 14:40:41
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/classes.java 
73 
74 
75 
76 
77 
78 
79 
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
91 
92 
93 
94 
95 
96 
97 
98 
99 
100 
101 
102 
103 
104 
105 
106 
107 
108 
109 
110 
111 
System.out.println("You ask him if he actually wrot" 
+ "e the book"); 
System.out.println("Vader: 'Do you lack faith in me" 
+ "?'"); 
System.out.println("he asks as he raises his hand." 
+ ""); 
System.out.println("You run out of the room"); 
scan++; // kill loop 
} catch (Exception e) { 
System.out.println("Please enter a number"); 
} 
} 
break; 
case 3: 
while (scan != 1) { 
try { 
System.out.println("You walk into the room and you " 
+ "see a lot of computers everywhere. A sol" 
+ "dier greets you."); 
System.out.println("Soldier: 'I don't have time to " 
+ "explain how this works, follow my instru" 
+ "ctions and we will see if it's operating" 
+ " appropriately.'"); 
xAndY.xAndYKing(); 
System.out.println("Soldier: I hope this is right," 
+ " move along."); 
scan++; // kill loop 
} catch (Exception e) { 
System.out.println("Please enter a number"); 
} 
} 
break; 
} 
} 
} 
} 
2.1 of 2 2014.12.03 14:40:41
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/collections.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 
40 
41 
42 
43 
44 
45 
46 
47 
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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class collections { 
public static void collectionsKing() { 
Scanner in = new Scanner(System.in); 
int scan, collect = 0; 
System.out.println("You walk up to the collections office."); 
System.out.println("Man: 'We're very busy what do you want!'"); 
System.out.println("Man: 'Oh, your here to pay a debt. I'll make you a " 
+ "deal.'"); 
System.out.println("Man: 'Help us with some paper work and we won't mak" 
+ "e you pay back your debt.!"); 
System.out.println("you can go to the counting office"); 
System.out.println("the counting office but slightly better"); 
System.out.println("Or the third counting office."); 
while (collect != 4) { 
scan = 0; // reset scan at the beginning of every loop 
System.out.println("Choose 1:counting office 1, 2: counting office " 
+ "2, 3: counting office 3, 4: leave."); 
collect = in.nextInt(); 
switch (collect) { 
case 1: 
while (scan != 1) { 
try { 
System.out.println("Man: Welcome to counting office" 
+ " 1."); 
System.out.println("Man: Give me a series of number" 
+ "s so I can pick out the largest number"); 
largestArray.largestArrayKing(); 
System.out.println("Man: You may go now."); 
scan++; // kills loop 
} catch (Exception e) { 
System.out.println("Please enter numbers"); 
} 
} 
break; 
case 2: 
while (scan != 1) { 
try { 
System.out.println("Man: Hello, welcome to the coun" 
+ "ting office 2."); 
System.out.println("Man: Give me a series of words " 
+ "and I will pick the largest word."); 
longestString.longestStringKing(); 
System.out.println("Man: You may go now."); 
scan++; // kills loop 
} catch (Exception e) { 
System.out.println("Please enter words"); 
} 
} 
break; 
case 3: 
while (scan != 1) { 
try { 
System.out.println("Man: Welcomg to counting office" 
+ "3."); 
System.out.println("Give me a series of numbers and" 
+ " i will tell you the largest number and " 
1.1 of 2 2014.12.03 14:22:41
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/collections.java 
73 
74 
75 
76 
77 
78 
79 
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
+ " i will tell you the largest number and " 
+ "where it appeared in your list."); 
longestArrayPosition.longestArrayPositionKing(); 
System.out.println("Man: You may go now."); 
scan++;//kills loop 
} catch (Exception e) { 
System.out.println("Please enter numbers"); 
} 
} 
break; 
} 
} 
} 
} 
2.1 of 2 2014.12.03 14:22:41
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/countingNumbers.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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class countingNumbers { 
public static void countingNumbersKing() { 
int number; 
Scanner in = new Scanner(System.in); 
System.out.println("What number do you give him?"); 
number = in.nextInt(); 
System.out.print("Clown: "); 
for (int x = 0; x <= number; x++) { // counts up 
System.out.println(x); 
} 
} 
} 
1.1 of 1 2014.12.03 14:58:46
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/cToF.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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class cToF { 
public static void cToFKing() { 
System.out.println("What temperature do you tell her?"); 
Scanner in = new Scanner(System.in); 
double Celcius = in.nextDouble(); 
double Fahrenheit; 
Fahrenheit = (Celcius * 9) / 5 + 32; // equation from C to F 
System.out.print("Storm: 'The temperature is now " + Fahrenheit); 
System.out.println(" degrees Fahrenheit.'"); 
} 
} 
1.1 of 1 2014.12.03 15:16:10
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/declareVariable.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 
40 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class declareVariable { 
public static void declareVariableKing() { 
caculateValues(); 
} 
static void caculateValues() { 
Scanner in = new Scanner(System.in); 
System.out.print("Enter a number:"); 
int a = in.nextInt(); 
System.out.print("Enter another number:"); 
int b = in.nextInt(); 
// This does the actual work 
int resultA = a + b; 
int resultS = a - b; 
int resultM = a * b; 
double resultD = a / b; 
System.out.println("The result of adding is " + resultA); 
System.out.println("The result of subtracting is " + resultS); 
System.out.println("The result of multiplying is " + resultM); 
System.out.println("The result of dividing is " + resultD); 
} 
} 
1.1 of 1 2014.12.03 13:29:19
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/dynamicAdding.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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class dynamicAdding { 
public static void dynamicAddingKing() { 
Scanner in = new Scanner(System.in); 
int sum = 0, number, addingv; 
System.out.println("Man: 'How many numbers would you like to add?'"); 
number = in.nextInt(); 
System.out.println("Man: 'G-good, give me " + number + " numbers to add" 
+ ".'"); 
for (int loopcontrol = 1; loopcontrol <= number; loopcontrol++) { 
addingv = in.nextInt(); //adds all numbers given together 
sum = sum + addingv; 
} 
System.out.println("Man: 'The sum is " + sum + "'"); 
} 
} 
1.1 of 1 2014.12.03 14:58:03
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/evenOnly.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 
40 
41 
42 
43 
44 
45 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class evenOnly { 
public static void evenOnlyKing() { 
Scanner in = new Scanner(System.in); 
int[] arr = new int[5]; 
int zero = 0; 
System.out.println("Jones: 'Just give me a few numbers boy, only 5 numb" 
+ "ers."); 
System.out.println("Which numbers do you enter?"); 
for (int arrlang = 0; arrlang < arr.length; arrlang++) { 
arr[arrlang] = in.nextInt(); 
} 
System.out.println("Jones: The even numbers you stated were: "); 
for (int counter = 0; counter < arr.length; counter++) { 
if (arr[counter] % 2 == 0) { 
System.out.println(arr[counter]); 
} else { 
zero++; 
} 
} 
if (zero == 5) { // if the program failed to find a number divisable by 
//two in the array than zero = 5 
System.out.println("Jones: 'Oh! None of the numbers you entered wer" 
+ "e even, that is boring, get out.'"); 
} 
} 
} 
1.1 of 1 2014.12.03 14:31:14
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/evenOrOdd.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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class evenOrOdd { 
public static void evenOrOddKing() { 
Scanner in = new Scanner(System.in); 
System.out.println("Enter a number:"); 
int num1 = in.nextInt(); 
int EVEN = 0; 
if (EVEN == num1 % 2) { 
//need curley braces after if statment. Need to put () around operation. 
System.out.println("The number you entered was even"); 
} else { 
System.out.println("The number you entered was odd"); 
} 
} 
} 
1.1 of 1 2014.12.03 13:21:11
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/flowControl.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 
40 
41 
42 
43 
44 
45 
46 
47 
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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class flowControl { 
public static void flowControlKing() { 
Scanner in = new Scanner(System.in); 
int flow = 0, scan; 
System.out.println("You enter the water control place and see a scragge" 
+ "ly old man standing infront of you"); 
System.out.print("Man: 'oh another traveler, we have a thing to tell yo" 
+ "u weight on other planets, "); 
System.out.println("an in house lottery, and a math testing don't break" 
+ " anything.'"); 
while (flow != 4) { 
scan = 0; 
System.out.println("Would you like to go to the 1:Space weight mach" 
+ "ine, 2: Lottery, 3: math test, or 4: leave?"); 
flow = in.nextInt(); 
switch (flow) { 
case 1: 
while (scan != 1) { 
try { 
System.out.println("You walk up to the Space Weight" 
+ " machine and see a keypad and a small ma" 
+ "n with a bunch of number cards"); 
spaceWeight.spaceWeightKing(); 
System.out.println("'Unfortunately you will suffoca" 
+ "te to death on these planets. Goodbye.' " 
+ "The machine says."); 
System.out.println("You go about your journy."); 
scan++;//kills loop 
} catch (Exception e) { 
System.out.println("Please enter a number"); 
} 
} 
break; 
case 2: 
while (scan != 1) { 
try { 
System.out.println("You walk into the room and find" 
+ " a lottery machine"); 
System.out.println("Machine: 'Please insert three d" 
+ "ollars and follow the instructions'"); 
System.out.println("You enter three dollars."); 
lotteryTicket.lotteryTicketKing(); 
System.out.println("You have no idea what this mean" 
+ "s or what the point values are used for." 
+ ""); 
System.out.println("You continue on your way."); 
scan++;//kills loop 
} catch (Exception e) { 
System.out.println("Please enter a number"); 
} 
} 
break; 
case 3: 
while (scan != 1) { 
try { 
System.out.println("You walk into the room and find" 
+ " a man in a business suit sitting in the" 
+ " corner"); 
System.out.println("Man: 'hello traveler, I am the " 
1.1 of 2 2014.12.03 15:11:49
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/flowControl.java 
78 
79 
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
91 
92 
93 
94 
95 
96 
+ "Architect. I control this world and choo" 
+ "se who gets to stay."); 
System.out.println("You inquire as to how someone c" 
+ "ould be kicked out"); 
System.out.println("Architect: 'If you fail this te" 
+ "st I am about to give you, you will be b" 
+ "anished."); 
tOrF.tOrFKing(); 
scan++;//kills the loop 
} catch (Exception e) { 
System.out.println("Please enter a number"); 
} 
} 
break; 
} 
} 
} 
} 
2.1 of 2 2014.12.03 15:11:49
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/forLoops.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 
40 
41 
42 
43 
44 
45 
46 
47 
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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class forLoops { 
public static void forLoopsKing() { 
Scanner in = new Scanner(System.in); 
int forLoop = 0, scan; 
System.out.println("You enter the for camp and find a clown waiting to " 
+ "greet you."); 
System.out.println("Clown: 'Welcome to the For tent, we have a few attr" 
+ "actions for you to visit.'"); 
System.out.println("Clown: 'A counting game, an adding game, and a mult" 
+ "iplication game!'"); 
while (forLoop != 4) { 
scan = 0; // reset sca every time the loop runs 
System.out.println("Would you like to visit: 1:Counting game, 2:Add" 
+ "ing game, 3:Multiplication game, or 4: leave. "); 
forLoop = in.nextInt(); 
switch (forLoop) { 
case 1: 
while (scan != 1) { 
try { 
System.out.println("You enter and see a clown cryin" 
+ "g in the middle of a room."); 
System.out.println("Clown: 'hm... OH, OH MY A VISIT" 
+ "OR! OH I AM SOOO LONELY!'"); 
System.out.println("The clown immediately jumps to " 
+ "greet you."); 
System.out.println("Clown: 'No one enjoys counting " 
+ "anymore, it's been so long since I've ha" 
+ "d a visitor"); 
System.out.println("Clown: 'Please do give me a num" 
+ "ber to count to'"); 
countingNumbers.countingNumbersKing(); 
System.out.println("Oh yes lovely, thank you good s" 
+ "ir!"); 
System.out.println("You attempt to exit."); 
System.out.println("Clown: 'Please tell them you en" 
+ "joyed the game'"); 
scan++;//kills loop 
} catch (Exception e) { 
System.out.println("Please enter a number"); 
} 
} 
break; 
case 2: 
while (scan != 1) { 
try { 
System.out.println("You enter the room and see a ma" 
+ "n being held in the bottom of a well wit" 
+ "h a clown pointing a hose at him"); 
System.out.println("Clown: 'Say hello!!!'"); 
System.out.println("Man: H-hello"); 
System.out.println("Clown: 'ASK HIM!'"); 
System.out.println("As the clown says this he lower" 
+ "s basket with a small chalkboard in it." 
); 
System.out.println("Man: 'I can add! I can add a lo" 
+ "t of numbers! Give me numbers!"); 
1.1 of 2 2014.12.03 14:59:19
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/forLoops.java 
73 
74 
75 
76 
77 
78 
79 
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
91 
92 
93 
94 
95 
96 
97 
98 
99 
100 
101 
102 
103 
104 
105 
106 
107 
108 
109 
110 
111 
112 
113 
114 
115 
116 
117 
118 
119 
120 
121 
+ "t of numbers! Give me numbers!"); 
dynamicAdding.dynamicAddingKing(); 
System.out.println("The clown nods and lowers the b" 
+ "ask back into the well"); 
System.out.println("Clown: 'Put the chalkboard in t" 
+ "he basket'"); 
System.out.println("Man: 'B-but I like this chalkb." 
+ ".."); 
System.out.println("Clown: 'PUT THE CHALKBOARD IN T" 
+ "HE D**N BASKET!'"); 
System.out.println("This reminds you of a movie you" 
+ " saw once, but you can't quite put your " 
+ "finger on it."); 
System.out.println("You leave."); 
scan++;//kills loop 
} catch (Exception e) { 
System.out.println("Please enter a number"); 
} 
} 
break; 
case 3: 
while (scan != 1) { 
try { 
System.out.println("You walk into the room and see." 
+ ".. what!"); 
System.out.println("Dude! It's a dragon! Really!!! " 
+ "Oh my lord! A real Dragon! Super excited" 
+ "."); 
System.out.println("Clown: 'We taught this dragon t" 
+ "o multiply, go on, give him something to" 
+ " multiply."); 
multipleMultiplication.multipleMultiplicationKing(); 
System.out.println("Dragon: 'I use to own the skies" 
+ ", till that blasted dovahkiin inprisoned" 
+ " me here.'"); 
scan++;//kills loop 
} catch (Exception e) { 
System.out.println("Please enter a number"); 
} 
} 
break;//kills loop 
} 
} 
} 
} 
2.1 of 2 2014.12.03 14:59:19
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/fToCm.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 
40 
41 
42 
43 
44 
45 
46 
47 
48 
49 
50 
51 
52 
53 
54 
55 
56 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.*; 
class fToCm { 
private static double height(int feet, int inches) { 
return (feet * 30.48) + (inches * 2.54); 
// 1 foot = 30.48 cm 
// 1 inch = 2.54 cm 
} 
public static void fToCmKing() { 
Scanner in = new Scanner(System.in); 
int continueLoop = 0; 
do { // do loop, never liked them. 
try { 
System.out.println("Official: 'Enter your height in feet'"); 
String feetstr = in.nextLine(); 
int feet = Integer.parseInt(feetstr); 
if (feet > 0) { 
System.out.println("Official: 'and how many inches'"); 
String inchesstr = in.nextLine(); 
int inches = Integer.parseInt(inchesstr); 
if (inches > 0) { 
double result = height(feet, inches); 
System.out.println("Official: 'you are " + result + " " 
+ "cm tall.'"); 
continueLoop++; // kills loop 
} else { 
throw new NumberFormatException(); 
} 
} else { 
throw new NumberFormatException(); 
} 
} catch (NumberFormatException e) { 
System.out.println("Official: 'Sir, you are not negitive " 
+ "feet tall, and letters are not a hight, stop fooling" 
+ " around.'"); 
} 
} while (continueLoop != 1); 
} 
} 
1.1 of 1 2014.12.03 14:49:03
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/iEquals3.java 
1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
public class iEquals3 { 
int i = 0; 
iEquals3 increment() { 
i++; 
return this; 
} 
void print() { 
System.out.println("i = " + i); 
} 
} 
1.1 of 1 2014.12.03 14:17:35
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/idNumber.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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
class idNumber { 
public static void idNumberKing() { 
Scanner in = new Scanner(System.in); 
String input; 
int num; 
try { 
System.out.println("Librarian: 'Out with it, tell me your Id " 
+ "number.'"); 
num = in.nextInt(); 
System.out.println("Librarian: 'This is a valid number, good.'"); 
} catch (Exception e) { 
System.out.println("Sorry that's not in our system, please leave."); 
} 
} 
} 
1.1 of 1 2014.12.03 14:50:17
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/inheritance.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 
40 
41 
42 
43 
44 
45 
46 
47 
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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class inheritance { 
public static void interitanceKing() { 
int choice = 0, scan; 
Scanner in = new Scanner(System.in); 
System.out.println("You see a lawer standing outside"); 
System.out.println("Lawer: 'Oh good we've been expecting you'"); 
System.out.println("Lawer: 'So he left you three things. However they a" 
+ "re left through codes."); 
System.out.println("Lawer: 'The first has to do with the radius of a ci" 
+ "rcle."); 
System.out.println("Lawer: 'The second has to do with a shopping list"); 
System.out.println("Lawer: 'The third is just the number 3."); 
while (choice != 4) { 
scan = 0; // reset scan at the beginning of every loop 
System.out.println("Choose 1: Circle, 2: Shopping, 3: 3 or 4: leave" 
+ ""); 
choice = in.nextInt(); 
switch (choice) { 
case 1: 
while (scan != 1) { 
try { 
System.out.println("Lawer: 'oh yes welcome. this wi" 
+ "ll be fast.'"); 
areaOfCircleAgain.areaOfCircleAgainKing(); 
System.out.println("Lawer: That is how much money y" 
+ "ou get, good, here you are.'"); 
System.out.println("He hands you the money."); 
System.out.println("Lawer: 'get out'"); 
scan++; // kills loop 
} catch (Exception e) { 
System.out.println("Please enter numbers"); 
} 
} 
break; 
case 2: 
while (scan != 1) { 
try { 
System.out.println("Lawer: 'finally, ok follow my i" 
+ "nstructions exactly please.'"); 
priceNameWeight.priceNameWeightKing(); 
System.out.println("Lawer: 'Very good, here you are" 
+ "'"); 
System.out.println("He hands you the items you aske" 
+ "d for and the amount you asked for'"); 
System.out.println("Lawer: 'I hate your grandfather" 
+ ", this is just rediculous.'"); 
scan++; // kills loop 
} catch (Exception e) { 
System.out.println("Please enter numbers"); 
} 
} 
break; 
case 3: 
while (scan != 1) { 
try { 
System.out.println("You walk into a room"); 
1.1 of 2 2014.12.03 14:27:08
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/inheritance.java 
73 
74 
75 
76 
77 
78 
79 
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
91 
92 
System.out.println("You walk into a room"); 
System.out.println("Lawer: 'you get i dollars.'"); 
System.out.println("You ask how much is i"); 
challenge equal = new challenge(); 
equal.iEquals3King(); 
System.out.println("Lawer: 'Here are your three dol" 
+ "lars'"); 
System.out.println("You thank him and leave."); 
scan++; // kills loop 
} catch (Exception e) { 
System.out.println("Please enter numbers"); 
} 
} 
} 
} 
} 
} 
2.1 of 2 2014.12.03 14:27:08
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/largestArray.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 
40 
41 
42 
43 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
import java.util.ArrayList; 
class largestArray { 
public static void largestArrayKing() { 
Scanner in = new Scanner(System.in); 
ArrayList<Integer> al = new ArrayList<>(); 
System.out.println("How many numbers will you give him?"); 
int size = in.nextInt(); 
System.out.println("tell him " +size +" integers."); 
// enter that many numbers to the array list 
while (size-- > 0) { 
// To add an element to the ArrayList 
al.add(in.nextInt()); 
} 
int max = Integer.MIN_VALUE; 
// determines largest integer 
for (Integer i : al) { 
if (max < i) { 
max = i; 
} 
} 
System.out.println("Man: The largest value is " + max + "."); 
} 
} 
1.1 of 1 2014.12.03 14:14:31
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/longestArrayPosition.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 
40 
41 
42 
43 
44 
45 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
import java.util.ArrayList; 
class longestArrayPosition { 
public static void longestArrayPositionKing() { 
Scanner in = new Scanner(System.in); 
ArrayList<Integer> al = new ArrayList<>(); 
System.out.println("How many numbers would you like to give him?"); 
int size = in.nextInt(); 
System.out.println("Tell him" + size + " numbers."); 
while (size-- > 0) { 
// To add an element to the ArrayList 
al.add(in.nextInt()); 
} 
int max = Integer.MIN_VALUE; 
int maxindex = 0; 
// determines the largest value and location of said value 
for (int i = 0; i < al.size(); i++) { 
if (max < al.get(i)) { 
max = al.get(i); 
maxindex = i; 
} 
} 
System.out.println("Man: The largest value is " + max + "; which is in " 
+ "slot " + maxindex); 
} 
} 
1.1 of 1 2014.12.03 14:09:33
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/longestString.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 
40 
41 
42 
43 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
import java.util.ArrayList; 
class longestString { 
public static void longestStringKing() { 
Scanner in = new Scanner(System.in); 
System.out.println("How many words would you like to give him?"); 
int length = in.nextInt(); 
ArrayList<String> al = new ArrayList<>(); 
System.out.println("Tell him some words"); 
for (int i = 0; i <= length; i++) { 
// To add an element to the ArrayList 
al.add(in.nextLine()); 
} 
int max = Integer.MIN_VALUE; 
// Determines the entry with the largest number of characters 
for (String i : al) { 
if (max < i.length()) { 
max = i.length(); 
} 
} 
System.out.println("Man: The longest word was " + max + " letters long." 
+ ""); 
} 
} 
1.1 of 1 2014.12.03 14:12:11
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/loops.java 
1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
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 
48 
49 
50 
51 
52 
53 
54 
55 
56 
57 
58 
59 
60 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class loops { 
public static void loopKing() { 
Scanner in = new Scanner(System.in); 
int loops2 = 0, scan; 
System.out.println("You walk up to the area and two clowns greet you."); 
System.out.println("One of them brandishes a 'for' on his chest, the ot" 
+ "her has the word 'while' printed on his."); 
System.out.println("For clown: 'Oh good a traveler come the Circus is t" 
+ "his way.'"); 
System.out.println("While clown: 'Oh sorry he is mistaken, it's really " 
+ "this way'"); 
while (loops2 != 3) { 
scan = 0; // reset scan at the beginning of the loop. 
System.out.println("Which clown do you with to follow? "); 
System.out.println("1: While clown, 2: for clown, or 3: Leave."); 
loops2 = in.nextInt(); 
switch (loops2) { 
case 1: 
while (scan != 1) { 
try { 
whileLoops.whileLoopsKing(); 
scan++; // kills loop 
} catch (Exception e) { 
System.out.println("Please enter a number"); 
} 
} 
break; 
case 2: 
while (scan != 1) { 
try { 
forLoops.forLoopsKing(); 
scan++; // kills loop 
} catch (Exception e) { 
System.out.println("Please enter a number"); 
} 
} 
break; 
} 
} 
} 
} 
1.1 of 1 2014.12.03 15:22:19
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/lotteryTicket.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 
40 
41 
42 
43 
44 
45 
46 
47 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class lotteryTicket { 
public static void lotteryTicketKing() { 
Scanner in = new Scanner(System.in); 
int a = 0, b = 0, c = 0, s, i = 0; 
while (i != 1) { 
System.out.println("Enter 3 values from 0 to 2:"); 
a = in.nextInt(); 
b = in.nextInt(); 
c = in.nextInt(); 
if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { 
System.out.println("Enter numbers only between 0 and 2."); 
}else{ 
i++; // restricts the variables to being between 1 and 2 
} 
} 
if (a == 2 && b == 2 && c == 2) { //covers all possibilities 
s = 10; 
} else if (a == b && b == c) { 
s = 5; 
} else if (a != b && c != a) { 
s = 1; 
} else { 
s = 0; 
} 
System.out.println("Value of your ticket:" + s); 
} 
} 
1.1 of 1 2014.12.03 15:07:12
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/luckyNumber.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 
40 
41 
42 
43 
44 
45 
46 
47 
48 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class luckyNumber { 
public static void luckyNumberKing() { 
String num1, num5; 
char num2, num7; 
int num3, num4 = 0, num6 = 0, num8; 
Scanner in = new Scanner(System.in); 
System.out.println("Enter Your birthdate(ddmmyy)"); 
num1 = in.nextLine(); 
for (int count = 0; count < num1.length(); count++) { 
num2 = num1.charAt(count); 
num3 = Character.getNumericValue(num2); 
num4 = num4 + num3; 
} 
/* The code above takes the string and removes each individual character 
from the string. Then turns it into an int, adds it with the sum of the 
numbers before it, if no numbers before it adds with 0. It keeps doing 
this till all numbers have been satisfied*/ 
num5 = String.valueOf(num4); 
for (int count = 0; count < num5.length(); count++) { 
num7 = num5.charAt(count); 
num8 = Character.getNumericValue(num7); 
num6 = num6 + num8; 
} 
System.out.println("Mey-Rin: 'Your lucky number is " + num6 + ".'"); 
} 
} 
1.1 of 1 2014.12.03 13:48:47
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/methods.java 
1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
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 
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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class methods { 
public static void methodKing() { 
Scanner in = new Scanner(System.in); 
int assassins = 0, scan; 
System.out.println("You walk up to the dark brotherhood and a man stops" 
+ " you"); 
System.out.println("Assassin: 'Why have you come here'"); 
System.out.println("You tell him you're here just to check things out a" 
+ "nd help if you can."); 
System.out.println("Assassin: 'Oh you're the replacement, wonderful com" 
+ "e along'"); 
System.out.println("The assassin brings you and sits you down at a desk" 
+ "."); 
System.out.println("Assassin: 'there is some business thats need to be " 
+ "taken care of, take care of it.'"); 
System.out.println("You see three folders on the desk, one talks about " 
+ "finding roots, the other talks about division"); 
System.out.println("the last talks of circles."); 
while (assassins != 4) { 
scan = 0; // reset scan at the beginning of the loop 
System.out.println("Do you want to 1: Do the job about roots, 2:" 
+ " divison, 3: circles, or " 
+ "4: leave?"); 
assassins = in.nextInt(); 
switch (assassins) { 
case 1: 
while (scan != 1) { 
try { 
System.out.println("You walk into a dark room where" 
+ " a man is chained up on the floor"); 
System.out.println("Assassin: 'We are training him " 
+ "to be an assassin, he must be smart, ask" 
+ " him to give the square root of a number" 
+ "'"); 
squareRootM.squareRootMKing(); 
System.out.println("You leave the room, very confus" 
+ "ed."); 
scan++; 
} catch (Exception e) { 
System.out.println("Please enter a number"); 
} 
} 
break; 
case 2: 
while (scan != 1) { 
try { 
System.out.println("You enter a room and within it " 
+ "you find an assassin pondering over a co" 
+ "mputer"); 
System.out.println("Assassin: 'Oh good, you're here" 
+ ", I need help. I need to find if two peo" 
+ "ple are related"); 
System.out.println("Assassin: 'We give all out targ" 
+ "ets numbers and if the numbers divide ev" 
+ "enly, they are related."); 
1.1 of 2 2014.12.03 15:21:56
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/methods.java 
73 
74 
75 
76 
77 
78 
79 
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
91 
92 
93 
94 
95 
96 
97 
98 
99 
100 
101 
102 
103 
104 
105 
106 
107 
+ "enly, they are related."); 
multipleOrNot.multipleOrNotKing(); 
System.out.println("You leave wondering if you've j" 
+ "ust saved a life."); 
scan++; 
} catch (Exception e) { 
System.out.println("Pleas enter a number!"); 
} 
} 
break; 
case 3: 
while (scan != 1) { 
try { 
System.out.println("You enter a room and see a man " 
+ "being interrogated by an assassin."); 
System.out.println("Assassin: 'Oh good, I require y" 
+ "our help, we need to make sure this man " 
+ "is still mentally able, ask him to "); 
System.out.println("find the area of a circle.'"); 
areaOfCircle.areaOfCircleKing(); 
System.out.println("Assassin: 'It seems he is still" 
+ " coherent, thank you friend.'"); 
System.out.println("You leave the room wondering if" 
+ " you just killed someone."); 
scan++; 
} catch (Exception e) { 
System.out.println("Pleas enter a number!"); 
} 
} 
break; 
} 
} 
} 
} 
2.1 of 2 2014.12.03 15:21:56
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/misc.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 
40 
41 
42 
43 
44 
45 
46 
47 
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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class misc { 
public static void miscKing() { 
Scanner in = new Scanner(System.in); 
int scan, miscChoice = 0; 
System.out.println("You walk down the street and come to a giant ca" 
+ "stle, the sign says 'Phantomhive residence'"); 
System.out.println("You get greeted by a tall thin man in a black t" 
+ "ux."); 
System.out.println("Sebastien: 'Hello, I am the butler and servent " 
+ "to my young master Ciel.'"); 
System.out.println("Sebastien: 'Ciel is busy today but we could use" 
+ " some help, the other butlers are quite incompitent.'"); 
System.out.println("Sebastien: 'Finnian needs help drawing a circle" 
+ ".'"); 
System.out.println("Sebastien: 'Baldroy needs help with master Ciel" 
+ "'s math homework.'"); 
System.out.println("Sebastien: 'May-Rin needs some help teling... f" 
+ "ortunes, i sware I just need to do everything around her" 
+ "e.'"); 
while (miscChoice != 4) { 
scan = 0; 
System.out.println("Choose 1: Drawing circles, 2: math homework " 
+ "3: fortune telling or 4: leave"); 
miscChoice = in.nextInt(); 
switch (miscChoice) { 
case 1: 
while (scan != 1) { 
try { 
System.out.println("You open a door and find papers" 
+ " thrown all over the place and Finnian c" 
+ "rying in the middle of them."); 
System.out.println("Finnian: 'oh thank god your her" 
+ "e! I need help, I need to finish this pr" 
+ "oject now or master sebastien will be ju" 
+ "st furious with me.'"); 
System.out.println("Finnian: 'you you please help m" 
+ "e!'"); 
System.out.println("You nod."); 
System.out.println("Finnian: 'oh thank you, you're " 
+ "the best! So I need to draw 1/4 of a cir" 
+ "cle in a quadrant but I can't decide whi" 
+ "ch quadrant to draw it in!"); 
quadOfAngle.quadOfAngleKing(); 
System.out.println("He is busy drawing and forgets " 
+ "that you exist, you leave the room."); 
scan++;//kills loop 
} catch (Exception e) { 
System.out.println("Please enter a number"); 
} 
} 
break; 
case 2: 
while (scan != 1) { 
try { 
System.out.println("You walk into a room and see Ba" 
+ "ldroy sititng at a desk next to a white " 
1.1 of 2 2014.12.03 14:22:11
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/misc.java 
73 
74 
75 
76 
77 
78 
79 
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
91 
92 
93 
94 
95 
96 
97 
98 
99 
100 
101 
102 
103 
104 
105 
106 
107 
108 
109 
110 
111 
112 
113 
114 
115 
116 
117 
118 
119 
120 
121 
122 
123 
124 
125 
126 
127 
+ "ldroy sititng at a desk next to a white " 
+ "board filled with equations."); 
System.out.println("Baldroy: 'Gah, I just can't fig" 
+ "gure this problem out!'"); 
System.out.println("He notices you"); 
System.out.println("Baldroy: 'Oh good sebastien sen" 
+ "t help! MATE! Over here I need ya!"); 
System.out.println("You walk over slowly and ask wh" 
+ "at the problem is"); 
System.out.println("Baldroy: 'I just can't do work " 
+ "alone, I need you to help me out!"); 
System.out.println("Baldroy: 'I gotta multiply matr" 
+ "icies together but I'm not sure if I rem" 
+ "ember how."); 
System.out.println("Baldroy: 'Could you give me two" 
+ " matricies and I'll see if I remeber.'"); 
multiplyMatricies.multiplyMatriciesKing(); 
System.out.println("Feeling good about helping out " 
+ "you leave in a better mood."); 
scan++; // kills loop 
} catch (Exception e) { 
System.out.println("Please enter a number"); 
} 
} 
break; 
case 3: 
while (scan != 1) { 
try { 
System.out.println("You walk into a room filled wit" 
+ "h pentagrams and symbols drawn across th" 
+ "e room."); 
System.out.println("Mey-Rin: 'Oh good! A new custom" 
+ "er it is, it is.'"); 
System.out.println("Mey-Rin: 'I can tell your fortu" 
+ "ne I can, I can."); 
System.out.println("Mey-Rin: 'What's your birthday?" 
+ " Tell me and I'll give you a lucky numbe" 
+ "r I will, I will."); 
luckyNumber.luckyNumberKing(); 
System.out.println("Mey-Rin: 'Oh that's a good numb" 
+ "er it is, it is."); 
System.out.println("You leave hurriedly."); 
scan++; // kills loop 
} catch (Exception e) { 
System.out.println("Please enter a number"); 
} 
} 
break; 
} 
} 
} 
} 
2.1 of 2 2014.12.03 14:22:11
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/multipleMultiplication.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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class multipleMultiplication { 
public static void multipleMultiplicationKing() { 
Scanner in = new Scanner(System.in); // in because patterns 
int answer; 
System.out.println("Give the dragon a number:"); 
int num1 = in.nextInt(); 
System.out.println("Give the dragon a number of multiples:"); 
int num2 = in.nextInt(); 
for (int num3 = 1; num3 <= num2; num3++) { 
answer = num1 * num3; //multiplies them all together, yay. 
System.out.println("Dragon: " + num1 + "*" + num3 + "=" + answer); 
} 
} 
} 
1.1 of 1 2014.12.03 14:56:37
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/multipleOrNot.java 
1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class multipleOrNot { 
public static void multipleOrNotKing() { 
Scanner in = new Scanner(System.in); 
System.out.println("Assassin: 'Enter the smaller number first please." 
+ "'"); 
int x = in.nextInt(); 
System.out.println("Assassin: 'Now the larger one'"); 
int y = in.nextInt(); 
System.out.println(multiples(x, y)); 
} 
public static boolean multiples(int x, int y) { 
boolean multiple; 
if (y % x == 0) { 
multiple = true; 
System.out.println("Assassin: 'Hm so it seems they are related, " 
+ "interesting'"); 
} else { 
multiple = false; 
System.out.println("Assassin: 'hm, it seems I've made an error. " 
+ "Thank you friend'"); 
} 
return multiple; 
} 
} 
1.1 of 1 2014.12.03 14:54:14
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/multiplicationSimple.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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class multiplicationSimple { 
public static void multiplicationSimpleKing() { 
Scanner in = new Scanner(System.in); 
System.out.println("'Enter the 1st number' the children ask excitedly"); 
int num1 = in.nextInt(); 
System.out.println("'Enter the 2nd number' the children ask excitedly"); 
int num2 = in.nextInt(); 
int product = num1 * num2; 
System.out.print("'The product of the two numbers is " + product); 
System.out.println("' The children shout with excitment."); 
} 
} 
1.1 of 1 2014.12.03 13:30:14
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/multiplyMatricies.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 
40 
41 
42 
43 
44 
45 
46 
47 
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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.*; 
class multiplyMatricies { 
public static void multiplyMatriciesKing() { 
Scanner in = new Scanner(System.in); 
int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; 
double num1, num2, num3, num4; 
// Makes sure the two matricies can be multiplied together 
while (scan != 1) { 
System.out.println("Baldroy: 'The first matrix is...'"); 
row1 = in.nextInt(); 
System.out.println("Baldroy: 'by...'"); 
collum1 = in.nextInt(); 
System.out.println("Baldroy: 'The second matric is...'"); 
row2 = in.nextInt(); 
System.out.println("Baldroy: 'by...'"); 
collum2 = in.nextInt(); 
if (collum1 == row2) { 
scan++; 
} else { 
System.out.println("The number of collums in matrix one must be" 
+ " equal to the number of rows in matrix 2"); 
} 
} 
double array[][] = new double[row1][collum1]; 
double array1[][] = new double[row2][collum2]; 
double array2[][] = new double[row1][collum2]; 
// fills matrix one 
for (int row = 0; row < row1; row++) { 
for (int collum = 0; collum < collum1; collum++) { 
num1 = row + 1; 
num2 = collum + 1; 
System.out.println("1st matrix, value in [" + (int) num1 + "][" 
+ (int) num2 + "]:"); 
array[row][collum] = in.nextDouble(); 
} 
} 
// fills matrix 2 
for (int row = 0; row < row2; row++) { 
for (int collum = 0; collum < collum2; collum++) { 
num1 = row + 1; 
num2 = collum + 1; 
System.out.println("2nd matrix, value in [" + (int) num1 + "][" 
+ (int) num2 + "]:"); 
array1[row][collum] = in.nextDouble(); 
} 
} 
// this does the heavy lifting, multiplies the two matricies together. 
for (int row = 0; row < row1; row++) { 
for (int collum = 0; collum < collum2; collum++) { 
num3 = 0; 
for (int count = 0; count < collum1; count++) { 
num4 = (array[row][count] * array1[count][collum]); 
num3 = num3 + num4; 
} 
array2[row][collum] = num3; 
1.1 of 2 2014.12.03 13:58:03
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/multiplyMatricies.java 
73 
74 
75 
76 
77 
78 
79 
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
array2[row][collum] = num3; 
} 
} 
System.out.println("Baldroy: 'Product of both matricies is :"); 
// prints the product of the two matricies 
for (int row = 0; row < row1; row++) { 
for (int collum = 0; collum < collum2; collum++) { 
System.out.print(array2[row][collum] + "t"); 
} 
System.out.println(); 
} 
System.out.println("'"); 
System.out.println("Baldroy: 'Yea, I think that's right! Awesome! Thank" 
+ "s little guy!"); 
} 
} 
2.1 of 2 2014.12.03 13:58:03
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/nameBookMail.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 
40 
41 
42 
43 
44 
45 
46 
47 
48 
49 
50 
51 
52 
53 
54 
55 
56 
57 
58 
59 
60 
61 
62 
63 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
class nameBookMail { 
public static void nameBookMailKing() { 
Scanner in = new Scanner(System.in); // in because patterns 
author aut; 
System.out.println("Vader: 'what's your name?'"); 
String someName = in.nextLine(); 
System.out.println("Vader: 'what's your email?"); 
String sEmail = in.nextLine(); 
System.out.println("Vader: 'Which of my books is this?'"); 
String sBook = in.nextLine(); 
aut = new author(); 
aut.name(someName); // gets name 
aut.email(sEmail); // gets mail 
aut.book(sBook); // gets book title 
System.out.println("The inscription reads:"); 
System.out.println(aut.name(someName) + "n" + aut.email(sEmail) 
+ "n" + aut.book(sBook)); 
} 
} 
class author { 
private String name, email, book; 
public String name(String name) { 
this.name = name; 
return name; 
} 
public String email(String email) { 
this.email = email; 
return email; 
} 
public String book(String book) { 
this.book = book; 
return book; 
} 
} 
1.1 of 2 2014.12.03 14:37:45
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/nameBookMail.java 
2.1 of 2 2014.12.03 14:37:45
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/numberOfAs.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 
40 
41 
42 
43 
44 
45 
46 
47 
48 
49 
50 
51 
52 
53 
54 
55 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class numberOfAs { 
public static void numberOfAsKing() { 
Scanner in = new Scanner(System.in); 
System.out.println("clown: 'Oh please do give me a sentance' "); 
String str = in.nextLine(); 
int count = 0; //number of a's 
int letterInString = 0; //letter in the string 
while (letterInString < str.length()) { 
if (str.charAt(letterInString) == 'a') { 
count++; // counts number of A's 
} 
letterInString++; // kills loop 
} 
if (count == 0) { // if no A's are in sentance, death scenario 
System.out.println("Clown: 'There are no A's in this sentance. " 
+ "I told you I like A's!"); 
System.out.println("The clown takes out a knife as two other " 
+ "clowns grab you from behind and hold you still"); 
System.out.println("Clown: 'I'll make an A!'"); 
System.out.println("The clown takes his knife and carves an A so " 
+ "deep in your chest that you bleed to death"); 
System.out.println("In your last moments you hear this:"); 
System.out.println("Clown: 'this man gave me a senace with no A's" 
+ " in it, for this I hang him here for all time, as a " 
+ "warning.'"); 
System.out.println("You died, try again."); 
} else { // if 1 or more a's in sentance 
System.out.print("Clown: 'Oh goodie there are " + count); 
System.out.println(" A's in this sentance, thank you for that, " 
+ "you may go.'"); 
System.out.println("You leave wondering what would have happened " 
+ "if you had given him a sentance without any A's"); 
} 
} 
} 
1.1 of 1 2014.12.03 15:05:12
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/operations.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 
40 
41 
42 
43 
44 
45 
46 
47 
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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class operations { 
public static void operationsKing() { 
Scanner in = new Scanner(System.in); 
int center = 0, scan; 
System.out.println("You walk up to the town hall and a gaurd stops you" 
); 
System.out.println("Gaurd: 'Hault! Who goes there"); 
System.out.println("You tell him your name and that you're a new advent" 
+ "urer"); 
System.out.println("Gaurd: 'Oh don't tell me, someone stole your sweet " 
+ "roll'"); 
System.out.println("You look at him confused, he lets out a large sigh" 
); 
System.out.print("Gaurd: 'Alright"); 
System.out.println(" Go on inside we have 2 math centers and a temperat" 
+ "ure converter inside, enjoy yourself.'"); 
System.out.println("You walk inside and see the centers and the convert" 
+ "er."); 
while (center != 4) { 
scan = 0; // reset scan at beginning of loop 
System.out.println("Where would you like to go? 1: math center 1, 2" 
+ ": math center 2, 3: temperature converter, or 4: leave?" 
); 
center = in.nextInt(); 
switch (center) { 
case 1: 
while (scan != 1) { 
try { 
System.out.println("You enter the first math center" 
+ " and you see a dog in the corner wagging" 
+ " his tale"); 
System.out.println("The writing on the wall asks yo" 
+ "u to bark a few times and the dog will r" 
+ "espond in barks"); 
arithmeticOperations.arithmeticOperationsKing(); 
System.out.println("While impressive, this is utter" 
+ "ly pointless, you go about your way."); 
scan++; 
} catch (Exception e) { 
System.out.println("Please enter a number"); 
} 
} 
break; 
case 2: 
while (scan != 1) { 
try { 
System.out.println("You see a single vollyball sitt" 
+ "ing on the floor."); 
System.out.println("The writing on the wall asks yo" 
+ "u to jump a few times and the ball will " 
+ "respond in bounces"); 
arithmeticOperations2.arithmeticOperations2King(); 
System.out.println("You find this odd and unsettlin" 
+ "g, you go about your way."); 
scan++; 
} catch (Exception e) { 
1.1 of 2 2014.12.03 15:20:14
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/operations.java 
73 
74 
75 
76 
77 
78 
79 
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
91 
92 
93 
94 
95 
96 
97 
98 
99 
100 
101 
102 
} catch (Exception e) { 
System.out.println("Please enter a number"); 
} 
} 
break; 
case 3: 
while (scan != 1) { 
try { 
System.out.println("You see storm from the X-men se" 
+ "ries standing in the middle of the room" 
+ ""); 
System.out.println("Storm: 'Tell me what temperatur" 
+ "e you want it to be, in celcius, and it " 
+ "shall be so'"); 
cToF.cToFKing(); 
System.out.println("You ask storm why she's doing t" 
+ "his instead of saving the world"); 
System.out.println("She gets upset with your inquir" 
+ "y and knocks you out of the room."); 
scan++; 
} catch (Exception e) { 
System.out.println("Please enter a number"); 
} 
} 
break; 
} 
} 
} 
} 
2.1 of 2 2014.12.03 15:20:14
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/palendromeCheck.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 
40 
41 
42 
43 
44 
45 
46 
47 
48 
49 
50 
51 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class palendromeCheck { 
public static void palendromeCheckKing() { 
Scanner in = new Scanner(System.in); 
int length, start = 0, stop, between, i; 
System.out.print("What word do you give them?"); 
String line = in.nextLine(); 
length = line.length(); 
stop = length - 1; 
between = (start + stop) / 2; 
/* scans the beginning and end of a sring to see if it's the same, stops 
when it gets half way through on both ends*/ 
for (i = start; i <= between; i++) { 
if (line.charAt(start) == line.charAt(stop)) { 
start++; 
stop--; 
} else { 
break; 
} 
} 
if (i == between + 1) { 
System.out.println("Carl: 'Class, is that a palendrome?'"); 
System.out.println("Class: 'Yes!'"); 
} else { 
System.out.println("Carl: 'Class, is that a palendrome?'"); 
System.out.println("Class: 'NO!'"); 
} 
} 
} 
1.1 of 1 2014.12.03 14:05:54
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/priceNameWeight.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 
40 
41 
42 
43 
44 
45 
46 
47 
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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
class priceNameWeight { 
public static void priceNameWeightKing() { 
Scanner in = new Scanner(System.in); 
System.out.println("Lawer: 'Name a product"); 
String name1 = in.nextLine(); 
System.out.println("Lawer: 'How much is it worth?"); 
double up = in.nextDouble(); 
System.out.println("Lawer: 'How many pounds of it will you be buying?"); 
double w = in.nextDouble(); 
WeighedItem item1 = new WeighedItem(); 
in.nextLine(); 
System.out.println("Lawer: 'Give me another product'"); 
String name2 = in.nextLine(); 
System.out.println("Lawer: 'And it's price per unit?'"); 
double up1 = in.nextDouble(); 
System.out.println("Lawer: 'How many of those do you want?'"); 
int q = in.nextInt(); 
CountedItem item2 = new CountedItem(); 
item1.setName(name1); 
item1.setPrice(up); 
item1.setWeight(w); 
item1.getName(); 
item1.getPrice(); 
item1.getWeight(); 
item1.toString(); 
item2.setName(name2); 
item2.setPrice(up1); 
item2.setWeight(q); 
item2.getName(); 
item2.getPrice(); 
item2.getWeight(); 
item2.toString(); 
} 
} 
class WeighedItem { 
private double weight; 
private double price; 
private String name; 
private double total; 
public WeighedItem() { 
} 
public void setWeight(double w) { 
weight = w; 
} 
public void setName(String name1) { 
name = name1; 
1.1 of 3 2014.12.03 14:19:35
73 
74 
75 
76 
77 
78 
79 
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
91 
92 
93
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/priceNameWeight.java 
145 
146 
147 
} 
} 
3.1 of 3 2014.12.03 14:19:35
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/quadOfAngle.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 
40 
41 
42 
43 
44 
45 
46 
47 
48 
49 
50 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class quadOfAngle { 
public static void quadOfAngleKing() { 
int angle = 0, scan = 0; 
Scanner in = new Scanner(System.in); 
System.out.println("Finnian: 'Oh! I know, give me an angle in degrees a" 
+ "nd whichever quadrant it's in I'll draw my circle there!"); 
// restricts the value of imput to between 0 and 360 
while (scan != 1) { 
angle = in.nextInt(); 
if (angle < 0 || angle > 360) { 
System.out.println("Finnian: 'Please, only a number between 0 a" 
+ "nd 360.'"); 
} else { 
scan++; 
} 
} 
int quadrant = 0; 
if (angle < 90 && angle > 0) { 
quadrant = 1; 
} else if (angle < 180 && angle > 90) { 
quadrant = 2; 
} else if (angle < 270 && angle > 180) { 
quadrant = 3; 
} else if (angle < 360 && angle > 270) { 
quadrant = 4; 
} 
System.out.println("Finnian: 'That's it! I'm drawing my circle in the " 
+ quadrant + " quadrant!'"); 
} 
} 
1.1 of 1 2014.12.03 13:59:59
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/quadRoot.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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class quadRoot { 
public static void quadRootKing() { 
Scanner scan = new Scanner(System.in); 
System.out.println("What number do you wish the example to be?"); 
double x = scan.nextDouble(); //x is the intiger/double 
double sqt = Math.sqrt(x); 
double quadroot = Math.sqrt(sqt); 
System.out.print("You explain how the square root is "); 
System.out.printf("%.5f", sqt); 
//"%.nf" Is printing a doublt to n decimal places 
System.out.println(""); //to add a line between result outputs 
System.out.print("You explain how the quadratic root is "); 
System.out.printf("%.5f", quadroot); 
System.out.println(""); 
} 
} 
1.1 of 1 2014.12.03 15:12:31
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/absValue.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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class absValue { 
public static void absValueKing() { 
Scanner in = new Scanner(System.in); 
System.out.println("Which number do you wish to be the example?"); 
int num1 = in.nextInt(); 
System.out.println("Which number do you wish to compare the first " 
+ "number to?"); 
int num2 = in.nextInt(); 
if (Math.abs(num1) == Math.abs(num2)) { 
//checks to see if the absolute value of num1 is the same as num2. 
System.out.println("true, they are absolute values of one a" 
+ "nother."); 
} else { 
System.out.println("false, the are not absolute values."); 
} 
} 
} 
1.1 of 1 2014.12.03 15:13:46
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/smallXLarge.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 
40 
41 
42 
43 
44 
45 
46 
47 
48 
49 
50 
51 
52 
53 
54 
55 
56 
57 
58 
59 
60 
61 
62 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class smallXLarge { 
public static void smallXLargeKing() { 
Scanner in = new Scanner(System.in); // in because patterns 
int sum = 0, luck = 50; 
int a[]; 
a = new int[10]; 
System.out.println("woman: 'Alright love, just give me 10 numbers hm?'" 
+ ""); 
for (int i = 0; i < 10; i++) { // fills the array 
a[i] = in.nextInt(); 
} 
int min = a[0]; 
int max = a[0]; 
for (int counter = 1; counter < a.length; counter++) { 
if (max < a[counter]) { /* if a[counter] is bigger than the number 
alreasy assigned to max replace max with said value.*/ 
max = a[counter]; 
} 
if (min > a[counter]) {/* if a[counter] is smaller than the number 
alreasy assigned to min replace min with said value.*/ 
min = a[counter]; 
} 
} 
System.out.println("Woman: 'Oh the fortune i'm getting is the number " 
+ "" + (max * min)); 
if (max * min == 0) { 
System.out.println("Woman: Sorry hun, you're going to die in your s" 
+ "leep tonight."); 
} else if (max * min < luck && max * min > 0) { 
System.out.println("Woman: 'Oh my deer boy you have bad luck, but y" 
+ "ou will live into yout 30's, after that the person you l" 
+ "ove most will kill you.'"); 
} else if (max * min > luck) { 
System.out.println("Woman: 'Oh you have good luck, I'm glad to see " 
+ "that for once one of the people on this ship aren't goin" 
+ "g to die soon."); 
} 
} 
} 
1.1 of 2 2014.12.03 14:30:11
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/smallXLarge.java 
2.1 of 2 2014.12.03 14:30:11
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/spaceWeight.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 
40 
41 
42 
43 
44 
45 
46 
47 
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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class spaceWeight { 
public static void spaceWeightKing() { 
double weight; 
int opt; 
Scanner in = new Scanner(System.in); // in because patterns 
System.out.print("Please enter your current earth weight. " 
+ "The machine says."); 
weight = in.nextFloat(); 
System.out.println(); 
System.out.println("I have information for the following planets :"); 
System.out.println("1.Venus 2.Mars 3.Jupiter 4.Saturn 5.Uranus" 
+ " 6.Neptune, which planet are you visiting?"); 
opt = in.nextInt(); 
double venus, mars, jupiter, saturn, uranus, neptune; 
venus = weight * 0.78; // 0.78 is the relitive gravity on venus 
mars = weight * 0.39; // 0.39 is the relative gravity on mars 
jupiter = weight * 2.65; // 2.65 is the relative gravity on jupiter 
saturn = weight * 1.17; // 1.17 is the relative gravity on saturn 
uranus = weight * 1.05; // 1.05 is the relative gravity on uranus 
neptune = weight * 1.23; // 1.23 is the relative gravity on neptune 
switch (opt) { 
case 1: 
System.out.println("The little man holds up number cards " 
+ "that read: Your weight in pounds is :" + venus); 
break; 
case 2: 
System.out.println("The little man holds up number cards " 
+ "that read: Your weight in pounds is :" + mars); 
break; 
case 3: 
System.out.println("The little man holds up number cards " 
+ "that read: Your weight in pounds is :" + jupiter); 
break; 
case 4: 
System.out.println("The little man holds up number cards " 
+ "that read: Your weight in pounds is :" + saturn); 
break; 
case 5: 
System.out.println("The little man holds up number cards " 
+ "that read: Your weight in pounds is :" + uranus); 
break; 
case 6: 
System.out.println("The little man holds up number cards " 
+ "that read: Your weight in pounds is :" + neptune); 
break; 
} 
} 
1.1 of 2 2014.12.03 15:08:36
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/spaceWeight.java 
73 
74 
75 
} 
} 
2.1 of 2 2014.12.03 15:08:36
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/squareRootM.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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class squareRootM { 
public static double number, answer; 
public static void calculateSquare(double number) { 
answer = Math.sqrt(number); 
System.out.println("The chained man answers: " + (int) answer); 
System.out.println("Assassin: 'Good, he is ready, thank you.'"); 
} 
public static void squareRootMKing() { 
squareRootM challenge = new squareRootM(); 
final Scanner in = new Scanner(System.in); 
System.out.print("Assassin: 'Choose a number'"); 
number = in.nextDouble(); 
squareRootM.calculateSquare(number); 
} 
} 
1.1 of 1 2014.12.03 14:55:54
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/stringLength.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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class stringLength { 
public static void stringLengthKing() { 
Scanner in = new Scanner(System.in); // in because patterns 
String enter; 
int lengths; 
System.out.println("which word do you want to say?"); 
enter = in.nextLine(); 
lengths = enter.length(); 
System.out.println("Daryl: 'hm, that's about" + lengths + " long.'"); 
} 
} 
1.1 of 1 2014.12.03 14:07:44
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/strings.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 
40 
41 
42 
43 
44 
45 
46 
47 
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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class strings { 
public static void stringsKing() { 
Scanner in = new Scanner(System.in); 
int scan, stringchoice = 0; 
System.out.println("Lady: 'Oh, yes hello. Welcome to this here humb" 
+ "le farm. Would you be interested in some work pumpkin?"); 
System.out.println("Lady: 'okay well, daryl needs help with measuri" 
+ "ng how long of a shot he needs to take.'"); 
System.out.println("Lady: 'Rick needs help learning how to yell.'"); 
System.out.println("Lady: 'and carl needs help in the classroom."); 
while (stringchoice != 4) { 
scan = 0; // reset scan at beginning of loop 
System.out.println("Choose 1: measuring length, 2: yelling, 3: clas" 
+ "sroom, or 4: leave"); 
stringchoice = in.nextInt(); 
switch (stringchoice) { 
case 1: 
while (scan != 1) { 
try { 
System.out.println("You walk up and see Daryl lying" 
+ " ontop of a truck with his sniper."); 
System.out.println("Daryl: 'hey there kid, carol se" 
+ "nt you here to help me right?'"); 
System.out.println("Daryl: 'just say something and " 
+ "I'll work out how long the word is, soun" 
+ "ds weird but it helps me'"); 
stringLength.stringLengthKing(); 
System.out.println("Daryl: 'thanks kid, move along." 
+ "'"); 
System.out.println("You leave."); 
scan++; // kills loop 
} catch (Exception e) { 
System.out.println("Please enter a string"); 
} 
} 
break; 
case 2: 
while (scan != 1) { 
try { 
System.out.println("You walk up and see rick runnin" 
+ "g around frantically."); 
System.out.println("Rick: 'have you seen Carl? I ca" 
+ "n't find him anywhere!'"); 
System.out.println("Rick: 'carl?'"); 
System.out.println("Rick: 'I've been having some tr" 
+ "ouble yelling lately, could you help?'"); 
System.out.println("Rick: 'Tell me something to yel" 
+ "l.'"); 
toUpperCase.toUpperCaseKing(); 
System.out.println("Rick: 'I still can't find him, " 
+ "but thanks anyway.'"); 
System.out.println("You leave, confused."); 
scan++; //kills loop 
} catch (Exception e) { 
System.out.println("Please enter a string"); 
} 
} 
1.1 of 2 2014.12.03 14:22:27
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/strings.java 
73 
74 
75 
76 
77 
78 
79 
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
91 
92 
93 
94 
95 
96 
97 
98 
99 
100 
101 
102 
103 
104 
105 
} 
break; 
case 3: 
while (scan != 1) { 
try { 
System.out.println("You walk up to a school house a" 
+ "nd see a young man standing infront of a" 
+ " chalk board and the name 'carl' written" 
+ " behind him."); 
System.out.println("Carl: 'Oh hey there, I'm teachi" 
+ "ng these kids about palendromes today, c" 
+ "an you help us out."); 
System.out.println("You nod"); 
System.out.println("Give us a word and we'll see if" 
+ " it's a palendrome or not."); 
palendromeCheck.palendromeCheckKing(); 
System.out.println("Carl: 'Good job, thanks for you" 
+ "r help.'"); 
System.out.println("You leave, it's weird, carl is " 
+ "actually in the house this time."); 
scan++; // kills loop 
} catch (Exception e) { 
System.out.println("Please enter a string"); 
} 
} 
break; 
} 
} 
} 
} 
2.1 of 2 2014.12.03 14:22:27
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/tOrF.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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class tOrF { 
public static void tOrFKing() { 
Scanner in = new Scanner(System.in); 
System.out.println("Architecht: 'What is 12+12?'"); 
int answer; 
answer = in.nextInt(); 
System.out.print(answer == 24 ? "True" : "False"); //compressed if 
if (answer == 24) { 
System.out.println("Architect: 'Good job, you may stay'"); 
System.out.println("The door behind you slowly opens, you leave"); 
} else { // you did math incorrectly, death scenario 
System.out.println("Architect: 'You chose, poorly.'"); 
System.out.println("The Architect dissapears and the room starts " 
+ "filling with darkness."); 
System.out.println("You hear voices speak in the dark"); 
System.out.println("Voices: 'We are so hungry'"); 
System.out.println("The last bit of light turns to darkness and " 
+ "you are eaten alive by the voices."); 
System.out.println("You died, try again."); 
} 
} 
} 
1.1 of 1 2014.12.03 15:06:21
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/toUpperCase.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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class toUpperCase { 
public static void toUpperCaseKing() { 
Scanner in = new Scanner(System.in); 
System.out.print("What do you tell him?"); 
// capitalizes the input 
String line = in.nextLine().toUpperCase(); 
System.out.println("Rick: '" + line); 
} 
} 
1.1 of 1 2014.12.03 14:07:27
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/tryNCatch.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 
40 
41 
42 
43 
44 
45 
46 
47 
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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class tryNCatch { 
public static void tryNCatchKing() { 
Scanner in = new Scanner(System.in); 
int StPigeonations = 0; // 100 points if you get the reference 
int scan; 
System.out.println("You enter the library and find a man sitting at a " 
+ "desk"); 
System.out.println("Man: 'Yes hello, welcome to the library we are " 
+ "undergoing renovations, only two rooms are available."); 
while (StPigeonations != 4) { 
scan = 0; 
System.out.println("Do you want to enter the 1:Id card office, " 
+ "2:The height converter 3:go into a closed off room or " 
+ "4:leave"); 
StPigeonations = in.nextInt(); 
switch (StPigeonations) { 
case 1: 
while (scan != 1) { 
try { 
System.out.println("You enter the Id card issuer an" 
+ "d a librarian looks up at you."); 
System.out.println("Librarian: 'Oh god another one," 
+ " okay come along I need some information" 
+ " from you."); 
System.out.println("Librarian: 'First, what is you " 
+ "Id number?'"); 
System.out.println("As you have not been issued one" 
+ " you look confused"); 
System.out.println("Librarian: 'Come along, the Id " 
+ "number, it's 10 or less numbers long."); 
System.out.println("You stare blankly and start to " 
+ "make up an Id number to give her hoping " 
+ "it's real."); 
idNumber.idNumberKing(); 
System.out.println("You walk out of the building."); 
scan++; // kills loop 
} catch (Exception e) { 
System.out.println("Please enter a number"); 
} 
} 
break; 
case 2: 
while (scan != 1) { 
try { 
System.out.println("You enter a room and see a very" 
+ " official looking man"); 
fToCm.fToCmKing(); 
System.out.println("Official: 'Thank you sir, you m" 
+ "ay go'"); 
scan++; // kills loop 
} catch (Exception e) { 
System.out.println("Please enter numbers"); 
} 
} 
break; 
case 3: 
1.1 of 2 2014.12.03 14:49:59
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/tryNCatch.java 
73 
74 
75 
76 
77 
78 
79 
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
91 
92 
93 
94 
95 
96 
97 
98 
99 
100 
101 
102 
103 
104 
105 
106 
107 
108 
109 
110 
case 3: 
while (scan != 1) { 
try { 
System.out.println("You sneak past the man and thro" 
+ "ugh a door reading 'do not pass'"); 
System.out.println("you enter a room and see a youn" 
+ "g boy standing quietly in the corner."); 
System.out.println("You say hello, slightly scared"); 
System.out.println("Boy: !... 'You shouldn't be in " 
+ "here'"); 
System.out.println("You ask him why he's in here"); 
System.out.println("Boy: 'I like it here. It's quie" 
+ "t"); 
System.out.println("You ask him name"); 
System.out.println("Boy: 'Ne.. Negeki'"); 
System.out.println("You greet him warmly and go to " 
+ "shake his hand, he backs away quickly"); 
System.out.println("Negeki: 'You can't touch me... " 
+ "We can play a game though, do you want t" 
+ "o play?'"); 
System.out.println("You nod."); 
System.out.println("Negeki: 'Okay, I'm thinking of " 
+ "multiple numbers, you only need to guess" 
+ " one of them it's divisable by 2 and one" 
+ " other number."); 
chooseANumber.chooseANumberKing(); 
scan++; // kills loop 
} catch (Exception e) { 
System.out.println("Please enter a number"); 
} 
} 
break; 
} 
} 
} 
} 
2.1 of 2 2014.12.03 14:49:59
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/variableSection.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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class variableSection { 
public static void variableking() { 
Scanner in = new Scanner(System.in); 
int scan, building = 0; 
System.out.println("You have chosen the land of variable knowldge"); 
System.out.println("You enter the town and you see the school house whe" 
+ "re the children learn multiplication."); 
System.out.println("You also see the factory where the workers create t" 
+ "hese things called, variables."); 
System.out.println("Lastly you see the export building, where they sepe" 
+ "rate between even and odd."); 
while (building != 4) { 
scan = 0; 
System.out.println("Which building would you like to visit? 1: The" 
+ " school, 2: The factory, 3: Exports or 4: leave?"); 
building = in.nextInt(); 
switch (building) { 
case 1: 
while (scan != 1) { 
try { 
System.out.println("The kids ask you to give them 2" 
+ " numbers to multiply."); 
multiplicationSimple.multiplicationSimpleKing(); 
System.out.println("The children thank you and you " 
+ "go about your way."); 
scan++; 
} catch (Exception e) { 
System.out.println("Pleas enter a number!"); 
} 
} 
break; 
case 2: 
while (scan != 1) { 
try { 
System.out.println("You enter the factory and see " 
+ "the CFO of the factory run up to you"); 
System.out.println("CFO: 'Oh thank god you've arriv" 
+ "ed, we need you to test the machine!'"); 
System.out.println("He says and quickly grabs you b" 
+ "uy the hand and drags you to the machin" 
+ "e"); 
System.out.println("CFO: 'just follow the instructi" 
+ "ons on the screen'"); 
declareVariable.declareVariableKing(); 
System.out.println("CFO: 'Oh it's working, wonderfu" 
+ "l. Thank you for your time."); 
System.out.println("They escort you out of the fact" 
+ "ory and you go about your way."); 
scan++; 
} catch (Exception e) { 
System.out.println("Pleas enter a number!"); 
} 
} 
break; 
case 3: 
while (scan != 1) { 
try { 
1.1 of 2 2014.12.03 13:26:55
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/variableSection.java 
try { 
System.out.println("You enter the export factory, m" 
+ "istaken for a worker, and immediately pu" 
+ "t to work."); 
System.out.println("Worker: 'Just enter numbers and" 
+ " the machine spits out an answer'"); 
evenOrOdd.evenOrOddKing(); 
System.out.println("Worker: 'Good job, but we're ov" 
+ "erstaffed, get out.'"); 
System.out.println("They kick you out of the buildi" 
+ "ng and you go about your way."); 
System.out.println("'Thanks obama' You think."); 
scan++; 
} catch (Exception e) { 
System.out.println("Pleas enter a number!"); 
} 
} 
break; 
} 
} 
} 
} 
2.1 of 2 2014.12.03 13:26:55
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/upOrDown.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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class upOrDown { 
public static void upOrDownKing() { 
Scanner in = new Scanner(System.in); 
System.out.println("Which number do you wish to be the example? " 
+ "preferably a decimal"); 
double dob = in.nextDouble(); 
int up = (int) Math.ceil(dob); 
int down = (int) Math.floor(dob); // math opperations need math.X(N) 
System.out.println("You explain how rounding this number up gets " 
+ "you " + up); 
System.out.println("You explain how rounding this number down gets " 
+ "you " + down); 
} 
} 
1.1 of 1 2014.12.03 15:13:27
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/whileLoops.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 
40 
41 
42 
43 
44 
45 
46 
47 
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 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
public class whileLoops { 
public static void whileLoopsKing() { 
Scanner in = new Scanner(System.in); 
int circus = 0; 
int scan = 0; 
System.out.println("You walk into the while tent and see all manner of " 
+ "creatures. A clown approaches you."); 
System.out.println("Clown: 'I am so sorry dear patron but only three of" 
+ " our exhibits are open today. The letter counter, box game, " 
+ "and adding game."); 
while (circus != 4) { 
scan = 0; 
System.out.println("Do you want to play 1: the letter counter, 2: t" 
+ "he box game, 3: the adding game, or 4: leave?"); 
circus = in.nextInt(); 
switch (circus) { 
case 1: 
while (scan != 1) { 
try { 
System.out.println("Clown: 'Hello! Oh how I do love" 
+ " the letter A. Give me a sentance I'll t" 
+ "ell you how many times A appears in it!" 
+ ""); 
numberOfAs.numberOfAsKing(); 
scan++; // kills loop 
} catch (Exception e) { 
System.out.println("Please enter a number"); 
} 
} 
break; 
case 2: 
while (scan != 1) { 
try { 
System.out.println("You enter the room and see a ra" 
+ "ther annoyed looking clown."); 
System.out.println("Clown: 'yes welcome to the box " 
+ "game I just need a little info from you " 
+ "to play.'"); 
System.out.println("You ask why the clown sounds so" 
+ " annoyed."); 
System.out.println("Clown: 'Just answer the questio" 
+ "ns and you'll see.'"); 
boxOfNumbers.boxOfNumbersKing(); 
System.out.println("Clown: 'Do you see how pointles" 
+ "s that was, this is what i do all day ev" 
+ "ery day.'"); 
System.out.println("Beofre you can ask the clown wh" 
+ "y he doesn't quit he says:"); 
System.out.println("Clown: 'Just leave there's 20 m" 
+ "ore people behind you.'"); 
scan++; // kills loop 
} catch (Exception e) { 
System.out.println("Please enter a number"); 
} 
} 
1.1 of 2 2014.12.03 15:05:32
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/whileLoops.java 
73 
74 
75 
76 
77 
78 
79 
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
91 
92 
93 
94 
95 
96 
97 
98 
99 
} 
break; 
case 3: 
while (scan != 1) { 
try { 
System.out.println("You walk into the room and find" 
+ " a clown with a clip board standing in t" 
+ "he room."); 
System.out.println("Clown: 'Yes come along I have a" 
+ " few questions before the game can begin" 
+ ".'"); 
addingFiveIntegers.addingFiveIntegersKing(); 
System.out.println("Before you can bring up that th" 
+ "is wasn't a game he kicks you out of his" 
+ " tent."); 
scan++; // kills loop 
} catch (Exception e) { 
System.out.println("Please enter a number"); 
} 
} 
break; 
} 
} 
} 
} 
2.1 of 2 2014.12.03 15:05:32
/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/xAndY.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 
34 
35 
36 
37 
38 
39 
40 
41 
42 
43 
44 
45 
46 
47 
48 
49 
50 
51 
52 
53 
54 
55 
56 
57 
58 
//********************************************************** 
// Assignment: Final Project 
// 
// Author: Andrew D. MacKoul 
// 
// Completion time: ≈ 12 hours 
// 
// Honor Code: I pledge that this program represents my own 
// program code. I received help from Prof. Vanselow 
// in designing and debugging my program. 
//********************************************************* 
package finale; 
import java.util.Scanner; 
class xAndY { 
public static void xAndYKing() { 
Scanner in = new Scanner(System.in); 
System.out.println("Soldier: 'Enter x coordinate'"); 
int num1 = in.nextInt(); 
System.out.println("Soldier: 'Enter y coordinate'"); 
int num2 = in.nextInt(); 
Point point = new Point(num1, num2); 
System.out.println("Soldier: 'It's in quadrant " + point.quadrant() + "" 
+ "'"); 
} 
} 
class Point { 
private int x, y; 
public Point(int num1, int num2) { 
x = num1; 
y = num2; 
} 
public int quadrant() { 
// determines the quadrant 
int quadrant = 0; 
if (x > 0 && y > 0) { 
quadrant = 1; 
} else if (x < 0 && y > 0) { 
quadrant = 2; 
} else if (x < 0 && y < 0) { 
quadrant = 3; 
} else if (x > 0 && y < 0) { 
quadrant = 4; 
} else if (x == 0 || y == 0) { 
System.out.println("This is on an axis."); 
} 
return quadrant; 
} 
} 
1.1 of 1 2014.12.03 14:34:50

Text adventure

  • 1.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/Finale.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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Random; import java.util.Scanner; public class Finale { public static void main(String[] args) { int crash = 0; // Introduction is outside the loop so it doesn't repeat when you fail. introduction.introductionking(); while (crash != 1) { crash = 0; try { Finale.finaleKing(args); crash++;//kills the program } catch (Exception e) { System.out.println("Please enter the number of the road you wi" + "sh to travel down."); } } } public static void finaleKing(String[] args) { Scanner in = new Scanner(System.in); int option, scan, randomNum, choosenum; int loopkill = 0; while (loopkill != 1) { scan = 0; Random rn = new Random(); int n = 15 - 2 + 1; int i = rn.nextInt() % n; randomNum = 1 + i; choosenum = Math.abs(randomNum); if (choosenum == 0) { choosenum++; } System.out.println("You have 6 roads infront of you."); System.out.println("1: The first road leads to the land of" + " variable knowledge."); System.out.println("2: The second road leads to the town hall " + "where the king conducts his operations."); System.out.println("3: The third road leads to the land of " + "'arithmos' meaning arithmetic in greek."); System.out.println("4: The fourth road leads to our water sourc" + "e, they control the flow of resources for the land." + ""); System.out.println("5: The fifth road leads to the circus, many" + " fun rides there, they just go in circles till you " + "stop them."); System.out.println("6: This road leads to the dark brotherhood" + ", they are assassins, their methods are...." + " questionable."); System.out.println("7: This road leads to the library, their " + "most famous book is The Catcher In The Try. I feel " + "like I said that wrong."); System.out.println("8: This road leads to a starship that's the siz" + "e of a small class 4 moon, we call it, The Death Star."); 1.1 of 4 2014.12.03 15:28:22
  • 2.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/Finale.java System.out.println("9: Thisleads to a pirate ship that is enhabite" + "d by 80's people. They constantly spout out: 'Arr... eee" + "ey!'"); System.out.println("10: Your grandad died, he left you some inherit" + "ance, go down this road to receive your inheritance."); System.out.println("11: Your being taxed and need to go to the coll" + "ections office, sorry. follow this road to pay your bill" + "s."); System.out.println("12: This leads to the farms, best known for sow" + "ing strings to make fabric."); System.out.println("13: This leads to the other road, we don't talk" + " about it, it's weird."); System.out.println("14: Random."); System.out.println("15: Or you may turn around and go home."); System.out.println("Which road do you chose? Enter a number."); option = in.nextInt(); if (option == 14) { option = choosenum; } if (option == 1) { while (scan != 1) { try { variableSection.variableking(); scan++; } catch (Exception e) { System.out.println("Please enter a number."); } } } else if (option == 2) { while (scan != 1) { try { operations.operationsKing(); scan++; } catch (Exception e) { System.out.println("Please enter a number."); } } } else if (option == 3) { while (scan != 1) { try { arithmatic.arithmaticKing(); scan++; } catch (Exception e) { System.out.println("Please enter a number."); } } } else if (option == 4) { while (scan != 1) { try { flowControl.flowControlKing(); scan++; } catch (Exception e) { System.out.println("Please enter a number."); } } } else if (option == 5) { while (scan != 1) { try { loops.loopKing(); scan++; } catch (Exception e) { System.out.println("Please enter a number."); } } } else if (option == 6) { while (scan != 1) { try { methods.methodKing(); scan++; 2.1 of 4 2014.12.03 15:28:22
  • 3.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/Finale.java scan++; }catch (Exception e) { System.out.println("Please enter a number."); } } } else if (option == 7) { while (scan != 1) { try { tryNCatch.tryNCatchKing(); scan++; } catch (Exception e) { System.out.println("Please enter a number."); } } } else if (option == 8) { while (scan != 1) { try { classes.classesKing(); scan++; } catch (Exception e) { System.out.println("Please enter a number."); } } } else if (option == 9) { while (scan != 1) { try { arrays.arraysKing(); scan++; } catch (Exception e) { System.out.println("Please enter a number"); } } } else if (option == 10) { while (scan != 1) { try { inheritance.interitanceKing(); scan++; } catch (Exception e) { System.out.println("Please enter a number"); } } } else if (option == 11) { while (scan != 1) { try { collections.collectionsKing(); scan++; } catch (Exception e) { System.out.println("Please enter a number"); } } } else if (option == 12) { while (scan != 1) { try { strings.stringsKing(); scan++; } catch (Exception e) { System.out.println("Please enter a number"); } } } else if (option == 13) { while (scan != 1) { try { misc.miscKing(); scan++; } catch (Exception e) { System.out.println("Please enter a number"); } } // to kill the loop, this is the only way to end the program } else if (option == 15) { System.out.println("You decide you've had enough traveling" + " for one day, you return home to go to bed."); loopkill = 1; 3.1 of 4 2014.12.03 15:28:22
  • 4.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/Finale.java loopkill =1; } else { System.out.println("Invalid entry, please try again."); } } } } 4.1 of 4 2014.12.03 15:28:22
  • 5.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/addingFiveIntegers.java 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class addingFiveIntegers { public static void addingFiveIntegersKing() { int total = 0; // stores the sum of the 5 numbers int number; // stores the current input Scanner scan = new Scanner(System.in); int a = 1; // limits loop to 5 while (a <= 5) {// limits loop to 5 System.out.print("Say a number please "); number = scan.nextInt(); total = total + number; a++; // This only exists to limit the loop to 5 } System.out.println("The total is: " + total); } } 1.1 of 1 2014.12.03 15:00:24
  • 6.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/areaOfCircle.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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class areaOfCircle { // Constant PI is defined at the class level static final double PI = Math.PI; public static double radius, area; void getArea() { // Method used to calculate area of a circle final Scanner sc = new Scanner(System.in); System.out.println("Assassin: 'Give him a radius, make him calculate " + "the area of the circle in his head'"); radius = sc.nextDouble(); area = PI * radius * radius; // equation of area of circle System.out.println("Man: The area of circle is: " + area); } public static void areaOfCircleKing() { areaOfCircle c1 = new areaOfCircle();//calls the calculations c1.getArea(); } } 1.1 of 1 2014.12.03 14:53:14
  • 7.
    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 34 35 36 37 38 39 40 41 42 43 44 45 46 47
  • 8.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/areaOfCircleAgain.java 73 74 75 76 77 78 79 80 81 82 83 84 }; circle1.setradius(radius); circle1.toString(); return "Radius " + radius + " and Area is " + area; } } } 2.1 of 2 2014.12.03 14:43:10
  • 9.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/arithmatic.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 40 41 42 43 44 45 46 47 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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class arithmatic { public static void arithmaticKing() { Scanner in = new Scanner(System.in); int problem = 0; int scan = 0; System.out.println("You enter the greak kingdome of arthimos, which jus" + "t turns out to be a pillow fort."); System.out.println("The 10 year old king adresses you"); System.out.println("King: 'Hello loyal subject, I am having trouble wit" + "h the homewrok issued by the dreadded"); System.out.println("Ms. Burns. I command your help'"); System.out.println("He hands you a piece of paper with problems on it. " + "You look at him confused."); System.out.println("King: 'We are not allowed to cheat so I ask you to " + "provide me with examples and solutions'"); while (problem != 4) { scan = 0; System.out.println("Which type of problem do you wish to help him w" + "ith?"); System.out.println("1: absolute value, 2:rounding up and down, 3: q" + "uadratic root or 4: leave?"); problem = in.nextInt(); switch (problem) { case 1: while (scan != 1) { try { absValue.absValueKing(); System.out.println("The young king thanks you and y" + "ou leave Arithmos the greatest pillow f" + "ort the worlds ever seen."); scan++; // ends loop } catch (Exception e) { System.out.println("Please enter a number"); } } break; case 2: while (scan != 1) { try { upOrDown.upOrDownKing(); System.out.println("The young king thanks you and y" + "ou leave Arithmos the greatest pillow fo" + "rt the worlds ever seen."); scan++; // ends loop } catch (Exception e) { System.out.println("Please enter a number"); } } break; case 3: while (scan != 1) { try { quadRoot.quadRootKing(); System.out.println("The young king thanks you and y" + "ou leave Arithmos the greatest pillow fo" 1.1 of 2 2014.12.03 15:14:50
  • 10.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/arithmatic.java 73 74 75 76 77 78 79 80 81 82 83 84 85 + "ou leave Arithmos the greatest pillow fo" + "rt the worlds ever seen."); scan++; // ends loop } catch (Exception e) { System.out.println("Please enter a number"); } } break; } } } } 2.1 of 2 2014.12.03 15:14:50
  • 11.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/arithmeticOperations.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 40 41 42 43 44 45 46 47 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class arithmeticOperations { public static void arithmeticOperationsKing() { int a, b; int resulta, results, resultm; double resultd; Scanner in = new Scanner(System.in); System.out.println("How many times do you wish to bark the first " + "time?"); a = in.nextInt(); System.out.println("How many times do you wish to bark the second " + "time?"); b = in.nextInt(); resulta = a + b; // addition results = a - b; // subtraction resultm = a * b; // multiplication resultd = (double) a / b; //division System.out.print("The dog barks back " + resulta); System.out.println(" times, this is clearly the result of addition"); System.out.print("The dog barks back " + results); System.out.println(" times, this is clearly the result of subtraction"); System.out.print("The dog barks back " + resultm); System.out.println(" times, this is clearly the result of " + "multiplication"); System.out.print("The dog barks back " + resultd); System.out.println(" times, this is clearly the result of subtraction"); } } 1.1 of 1 2014.12.03 15:20:17
  • 12.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/arithmeticOperations2.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 40 41 42 43 44 45 46 47 48 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class arithmeticOperations2 { public static void arithmeticOperations2King() { Scanner in = new Scanner(System.in); // in because patterns int sum, diff, product, quotient; //much more compact. System.out.println("How mnay times would you like to jump the first " + "time?"); int num1 = in.nextInt(); System.out.println("How many times would you like to jump the second " + "time?"); int num2 = in.nextInt(); sum = num1 + num2; diff = num1 - num2; product = num1 * num2; quotient = num1 / num2; System.out.print("The ball bounces " + sum); System.out.println(" times, this is clearly the result of addition"); System.out.print("the ball bounces " + diff); System.out.println(" times, this is clearly the result of subtraction"); System.out.print("The ball bounces " + product); System.out.println(" times, this clearly is the result of subtraction"); System.out.print("The ball sits quietly and then freaks out bouncing " + "off the walls " + quotient); System.out.println(" times ending with smacking you in the head."); System.out.println("The ball clearly doesnt like the number " + quotient); } } 1.1 of 1 2014.12.03 15:20:18
  • 13.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/arrays.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 40 41 42 43 44 45 46 47 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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class arrays { public static void arraysKing() { Scanner in = new Scanner(System.in); int arraychoice = 0, scan; System.out.println("You walk up to the pirate ship and see a pirate" + "."); System.out.println("Pirate: 'Arr ye matey! If ye with entry thy must wa" + "lk the plank!'"); System.out.println("You get cautious but then you see that the entrance" + "to the pirate ship is just a plank of wood. You cross it."); System.out.println("Pirate: 'Arr good job laddeh, you passed the first" + " test.'"); System.out.println("Pirate: 'There be 3 other tests, ye may come and " + "go as ye please."); System.out.println("Pirate: 'Ye can go to the school where we teach th" + "e youngins.'"); System.out.println("Pirae: 'Ye can go to the playin' station where we b" + "e playin' Liar's dice.'"); System.out.println("Pirate: Or ye can go and see the fortune teller."); while (arraychoice != 4) { scan = 0; System.out.println("Where would you like to go?"); System.out.println("1:The school, 2:The game, 3:The fortune teller," + " or 4:Leave?"); arraychoice = in.nextInt(); switch (arraychoice) { case 1: while (scan != 1) { try { System.out.println("You walk through a door and fin" + "d a teacher and a bunch of kids sitting " + "at desks."); System.out.println("Pirate: 'Ay good, we got us a l" + "ive one kids!'"); System.out.println("The kids cheer and bang on thei" + "r desks loudly."); System.out.println("Pirate: 'Okay settle down ye mo" + "nsters. Greeting boy, we want to as a fa" + "vor of ya.'"); System.out.println("You notice and pistol in his po" + "cket and nod."); arraySum.arraySumKing(); System.out.println("Pirate: 'Thank ye boy, you may " + "go.'"); scan++; //kills loop } catch (Exception e) { System.out.println("Please enter numbers only."); } } break; case 2: while (scan != 1) { try { System.out.println("Jones: 'Oh, what fortuitous cer" + "cumstances be this, a crew member i have" + " yet to lay my eyes on. A piece of, fres" + "h meat.'"); 1.1 of 2 2014.12.03 14:33:18
  • 14.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/arrays.java 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 + "h meat.'"); System.out.println("You try to back away but two me" + "n now gaurd the doors."); System.out.println("Jones: 'Oh my scared friend, no" + " need to run, I just want to play a quic" + "k game."); System.out.println("You nod and try to get done as " + "fast as possible."); evenOnly.evenOnlyKing(); System.out.println("You nod and leave."); scan++; //kills loop } catch (Exception e) { System.out.println("Please enter numbers only."); } } break; case 3: while (scan != 1) { try { System.out.println("You enter the room and a lovely" + " woman greets you."); System.out.println("Woman: 'Oh hello there darlin, " + "just sit down and i'll tell your fortune" + "'"); System.out.println("You sit in the chair and for th" + "e first time you aren't scared."); smallXLarge.smallXLargeKing(); System.out.println("You smile, thank the woman and " + "walk out of the room."); scan++; //kills loop } catch (Exception e) { // possible death scenario System.out.println("woman: 'YOU BRAT! I SAID GIVE M" + "E NUMBERS AND YOU DID THIS! I guess you " + "want to die."); System.out.println("The woman stabs you and cuts ou" + "t your heart"); System.out.println("This is what happens when you d" + "ont follow directions, go back and try a" + "gain."); } } } } } } 2.1 of 2 2014.12.03 14:33:18
  • 15.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/arraySum.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 40 41 42 43 44 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class arraySum { public static void arraySumKing() { Scanner in = new Scanner(System.in); int sum = 0; int a[] = new int[10]; // array with 10 values System.out.println("Pirate: 'Ok ya wee laddeh, give us 10 numbers for t" + "he wee kids to add.'"); // fills the array for (int i = 0; i < 10; i++) { a[i] = in.nextInt(); if (i == 9) { break; } } // adds the values of the array for (int i = 0; i < 10; i++) { sum += a[i]; } System.out.println("Kids: 'The sum of..'"); System.out.println("The pirate teacher places a hand on his pistol"); System.out.println("Kids: 'The combined value of ye numbers be " + sum); System.out.println("The pirate teacher smiles and nods."); } } 1.1 of 1 2014.12.03 14:33:01
  • 16.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/boxOfNumbers.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 40 41 42 43 44 45 46 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class boxOfNumbers { public static void boxOfNumbersKing() { Scanner in = new Scanner(System.in); System.out.println("Clown: 'What's your height?'"); int height = in.nextInt(); System.out.println("Clown: 'And your width?'"); int width = in.nextInt(); int col; // collums int row = 1; // rows System.out.println("The clown claps his hands and"); // this will later be used to multiply matricies together while (row <= height) { System.out.println(""); row++; col = 1; while (col <= width) { System.out.print("#"); col++; } } System.out.println(""); System.out.println("appears in the air"); } } 1.1 of 1 2014.12.03 15:03:30
  • 17.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/challenge.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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; public class challenge extends iEquals3 { // gets all them operations void iEquals3King() { iEquals3 equal = new iEquals3(); for (int j = 0; j < 3; j++) { equal.increment(); } equal.print(); } } 1.1 of 1 2014.12.03 14:17:52
  • 18.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/chooseANumber.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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; class chooseANumber { public static void chooseANumberKing() { Scanner in = new Scanner(System.in); System.out.println("Negeki: 'Have you guessed the number?'"); int input = in.nextInt(); try { // checks if the number is divisable by both 5 and 2 if (input % 5 == 0 && input % 2 == 0) { System.out.println("Negeki: 'correct, thank you, no one ever " + "talks to me'"); System.out.println("He vanishes and you walk out of the room"); } else { throw new NumberFormatException(); } } catch (NumberFormatException e) { System.out.println("Negeki: 'Wrong, thank you for talking to me" + " ever since the accident it seems that everyone avoids" + " me"); } } } 1.1 of 1 2014.12.03 14:44:33
  • 19.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/circleColor.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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; class circleColor { public static void circlecolorKing() { Scanner in = new Scanner(System.in); // in because patterns int sum = 0; System.out.println("What is the radius in killometers?"); double r = in.nextInt(); if (70 <= r && r <= 80) { // actual radius of death star in movies. System.out.println("Trooper: 'huh, thats roughly the same size this" + " one is, good choice.'"); } myCircle user = new myCircle(); user.setRadius(r); // making sure the radius is at least 1 System.out.println("what color should it be?"); String col = in.next(); //color is a string System.out.println(user.getArea()); // calulate area System.out.println(col); // the color } } class myCircle { private double radius; public void setRadius(double r) { if (r > 0) { radius = r; } else { radius = 1; } } public double getArea() { double area; area = (3.141592653589793) * radius * radius; //pi is a big small number return area; } } 1.1 of 1 2014.12.03 14:38:54
  • 20.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/classes.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 40 41 42 43 44 45 46 47 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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class classes { public static void classesKing() { Scanner in = new Scanner(System.in); int classChoice = 0, scan = 0; System.out.println("you reach an elivator and get launched into sp" + "ace, after a 20 minute journy the doors open and a man" + "greets you."); System.out.println("Grunt: 'hello new recruit, we are here to defe" + "at these enemies of peace called Jedi."); System.out.println("Grunt: 'You have two ways to help out here and " + "one relaxation area."); while (classChoice != 4) { scan = 0; System.out.println("Grunt: 'You can go to the 1:Design area, 2:Dar" + "h vader book signing, 3:Targeting area, or 4:Leave."); classChoice = in.nextInt(); switch (classChoice) { case 1: while (scan != 1) { try { System.out.println("You enter the design area and " + "there is a storm trooper there to greet" + "you."); System.out.println("Trooper: 'Hello soldier! We are" + " creating more Death Stars in order to h" + "elp the peaceful takeover of the galaxy" + ".'"); System.out.println("Trooper: 'We don't want to get " + "them mixed up so we ask you to give us" + "the radius of the deathstar, and the col" + "or.'"); circleColor.circlecolorKing(); System.out.println("Trooper: 'hm yes good, ok you " + "may go.'"); scan++;// kill loop } catch (Exception e) { System.out.println("Please enter a number"); } } break; case 2: while (scan != 1) { try { System.out.println("You enter the room and everyone" + "is standing very worried in a line as lo" + "rd vader was signing their books."); System.out.println("You stand in line till you get " + "to the front"); nameBookMail.nameBookMailKing(); System.out.println("Vader: 'You should check out my" + " new book 'fear and trembling.'"); System.out.println("He hands you a book titled fear" + " and trembling. At the bottom where it s" + "ays who the author is, the name Johannes" + " de silentio is crossed out, and Anakin " + "skywalker is written in sharpie."); System.out.println("You ask him if he actually wrot" 1.1 of 2 2014.12.03 14:40:41
  • 21.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/classes.java 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 System.out.println("You ask him if he actually wrot" + "e the book"); System.out.println("Vader: 'Do you lack faith in me" + "?'"); System.out.println("he asks as he raises his hand." + ""); System.out.println("You run out of the room"); scan++; // kill loop } catch (Exception e) { System.out.println("Please enter a number"); } } break; case 3: while (scan != 1) { try { System.out.println("You walk into the room and you " + "see a lot of computers everywhere. A sol" + "dier greets you."); System.out.println("Soldier: 'I don't have time to " + "explain how this works, follow my instru" + "ctions and we will see if it's operating" + " appropriately.'"); xAndY.xAndYKing(); System.out.println("Soldier: I hope this is right," + " move along."); scan++; // kill loop } catch (Exception e) { System.out.println("Please enter a number"); } } break; } } } } 2.1 of 2 2014.12.03 14:40:41
  • 22.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/collections.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 40 41 42 43 44 45 46 47 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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class collections { public static void collectionsKing() { Scanner in = new Scanner(System.in); int scan, collect = 0; System.out.println("You walk up to the collections office."); System.out.println("Man: 'We're very busy what do you want!'"); System.out.println("Man: 'Oh, your here to pay a debt. I'll make you a " + "deal.'"); System.out.println("Man: 'Help us with some paper work and we won't mak" + "e you pay back your debt.!"); System.out.println("you can go to the counting office"); System.out.println("the counting office but slightly better"); System.out.println("Or the third counting office."); while (collect != 4) { scan = 0; // reset scan at the beginning of every loop System.out.println("Choose 1:counting office 1, 2: counting office " + "2, 3: counting office 3, 4: leave."); collect = in.nextInt(); switch (collect) { case 1: while (scan != 1) { try { System.out.println("Man: Welcome to counting office" + " 1."); System.out.println("Man: Give me a series of number" + "s so I can pick out the largest number"); largestArray.largestArrayKing(); System.out.println("Man: You may go now."); scan++; // kills loop } catch (Exception e) { System.out.println("Please enter numbers"); } } break; case 2: while (scan != 1) { try { System.out.println("Man: Hello, welcome to the coun" + "ting office 2."); System.out.println("Man: Give me a series of words " + "and I will pick the largest word."); longestString.longestStringKing(); System.out.println("Man: You may go now."); scan++; // kills loop } catch (Exception e) { System.out.println("Please enter words"); } } break; case 3: while (scan != 1) { try { System.out.println("Man: Welcomg to counting office" + "3."); System.out.println("Give me a series of numbers and" + " i will tell you the largest number and " 1.1 of 2 2014.12.03 14:22:41
  • 23.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/collections.java 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 + " i will tell you the largest number and " + "where it appeared in your list."); longestArrayPosition.longestArrayPositionKing(); System.out.println("Man: You may go now."); scan++;//kills loop } catch (Exception e) { System.out.println("Please enter numbers"); } } break; } } } } 2.1 of 2 2014.12.03 14:22:41
  • 24.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/countingNumbers.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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class countingNumbers { public static void countingNumbersKing() { int number; Scanner in = new Scanner(System.in); System.out.println("What number do you give him?"); number = in.nextInt(); System.out.print("Clown: "); for (int x = 0; x <= number; x++) { // counts up System.out.println(x); } } } 1.1 of 1 2014.12.03 14:58:46
  • 25.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/cToF.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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class cToF { public static void cToFKing() { System.out.println("What temperature do you tell her?"); Scanner in = new Scanner(System.in); double Celcius = in.nextDouble(); double Fahrenheit; Fahrenheit = (Celcius * 9) / 5 + 32; // equation from C to F System.out.print("Storm: 'The temperature is now " + Fahrenheit); System.out.println(" degrees Fahrenheit.'"); } } 1.1 of 1 2014.12.03 15:16:10
  • 26.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/declareVariable.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 40 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class declareVariable { public static void declareVariableKing() { caculateValues(); } static void caculateValues() { Scanner in = new Scanner(System.in); System.out.print("Enter a number:"); int a = in.nextInt(); System.out.print("Enter another number:"); int b = in.nextInt(); // This does the actual work int resultA = a + b; int resultS = a - b; int resultM = a * b; double resultD = a / b; System.out.println("The result of adding is " + resultA); System.out.println("The result of subtracting is " + resultS); System.out.println("The result of multiplying is " + resultM); System.out.println("The result of dividing is " + resultD); } } 1.1 of 1 2014.12.03 13:29:19
  • 27.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/dynamicAdding.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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class dynamicAdding { public static void dynamicAddingKing() { Scanner in = new Scanner(System.in); int sum = 0, number, addingv; System.out.println("Man: 'How many numbers would you like to add?'"); number = in.nextInt(); System.out.println("Man: 'G-good, give me " + number + " numbers to add" + ".'"); for (int loopcontrol = 1; loopcontrol <= number; loopcontrol++) { addingv = in.nextInt(); //adds all numbers given together sum = sum + addingv; } System.out.println("Man: 'The sum is " + sum + "'"); } } 1.1 of 1 2014.12.03 14:58:03
  • 28.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/evenOnly.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 40 41 42 43 44 45 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class evenOnly { public static void evenOnlyKing() { Scanner in = new Scanner(System.in); int[] arr = new int[5]; int zero = 0; System.out.println("Jones: 'Just give me a few numbers boy, only 5 numb" + "ers."); System.out.println("Which numbers do you enter?"); for (int arrlang = 0; arrlang < arr.length; arrlang++) { arr[arrlang] = in.nextInt(); } System.out.println("Jones: The even numbers you stated were: "); for (int counter = 0; counter < arr.length; counter++) { if (arr[counter] % 2 == 0) { System.out.println(arr[counter]); } else { zero++; } } if (zero == 5) { // if the program failed to find a number divisable by //two in the array than zero = 5 System.out.println("Jones: 'Oh! None of the numbers you entered wer" + "e even, that is boring, get out.'"); } } } 1.1 of 1 2014.12.03 14:31:14
  • 29.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/evenOrOdd.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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class evenOrOdd { public static void evenOrOddKing() { Scanner in = new Scanner(System.in); System.out.println("Enter a number:"); int num1 = in.nextInt(); int EVEN = 0; if (EVEN == num1 % 2) { //need curley braces after if statment. Need to put () around operation. System.out.println("The number you entered was even"); } else { System.out.println("The number you entered was odd"); } } } 1.1 of 1 2014.12.03 13:21:11
  • 30.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/flowControl.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 40 41 42 43 44 45 46 47 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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class flowControl { public static void flowControlKing() { Scanner in = new Scanner(System.in); int flow = 0, scan; System.out.println("You enter the water control place and see a scragge" + "ly old man standing infront of you"); System.out.print("Man: 'oh another traveler, we have a thing to tell yo" + "u weight on other planets, "); System.out.println("an in house lottery, and a math testing don't break" + " anything.'"); while (flow != 4) { scan = 0; System.out.println("Would you like to go to the 1:Space weight mach" + "ine, 2: Lottery, 3: math test, or 4: leave?"); flow = in.nextInt(); switch (flow) { case 1: while (scan != 1) { try { System.out.println("You walk up to the Space Weight" + " machine and see a keypad and a small ma" + "n with a bunch of number cards"); spaceWeight.spaceWeightKing(); System.out.println("'Unfortunately you will suffoca" + "te to death on these planets. Goodbye.' " + "The machine says."); System.out.println("You go about your journy."); scan++;//kills loop } catch (Exception e) { System.out.println("Please enter a number"); } } break; case 2: while (scan != 1) { try { System.out.println("You walk into the room and find" + " a lottery machine"); System.out.println("Machine: 'Please insert three d" + "ollars and follow the instructions'"); System.out.println("You enter three dollars."); lotteryTicket.lotteryTicketKing(); System.out.println("You have no idea what this mean" + "s or what the point values are used for." + ""); System.out.println("You continue on your way."); scan++;//kills loop } catch (Exception e) { System.out.println("Please enter a number"); } } break; case 3: while (scan != 1) { try { System.out.println("You walk into the room and find" + " a man in a business suit sitting in the" + " corner"); System.out.println("Man: 'hello traveler, I am the " 1.1 of 2 2014.12.03 15:11:49
  • 31.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/flowControl.java 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 + "Architect. I control this world and choo" + "se who gets to stay."); System.out.println("You inquire as to how someone c" + "ould be kicked out"); System.out.println("Architect: 'If you fail this te" + "st I am about to give you, you will be b" + "anished."); tOrF.tOrFKing(); scan++;//kills the loop } catch (Exception e) { System.out.println("Please enter a number"); } } break; } } } } 2.1 of 2 2014.12.03 15:11:49
  • 32.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/forLoops.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 40 41 42 43 44 45 46 47 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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class forLoops { public static void forLoopsKing() { Scanner in = new Scanner(System.in); int forLoop = 0, scan; System.out.println("You enter the for camp and find a clown waiting to " + "greet you."); System.out.println("Clown: 'Welcome to the For tent, we have a few attr" + "actions for you to visit.'"); System.out.println("Clown: 'A counting game, an adding game, and a mult" + "iplication game!'"); while (forLoop != 4) { scan = 0; // reset sca every time the loop runs System.out.println("Would you like to visit: 1:Counting game, 2:Add" + "ing game, 3:Multiplication game, or 4: leave. "); forLoop = in.nextInt(); switch (forLoop) { case 1: while (scan != 1) { try { System.out.println("You enter and see a clown cryin" + "g in the middle of a room."); System.out.println("Clown: 'hm... OH, OH MY A VISIT" + "OR! OH I AM SOOO LONELY!'"); System.out.println("The clown immediately jumps to " + "greet you."); System.out.println("Clown: 'No one enjoys counting " + "anymore, it's been so long since I've ha" + "d a visitor"); System.out.println("Clown: 'Please do give me a num" + "ber to count to'"); countingNumbers.countingNumbersKing(); System.out.println("Oh yes lovely, thank you good s" + "ir!"); System.out.println("You attempt to exit."); System.out.println("Clown: 'Please tell them you en" + "joyed the game'"); scan++;//kills loop } catch (Exception e) { System.out.println("Please enter a number"); } } break; case 2: while (scan != 1) { try { System.out.println("You enter the room and see a ma" + "n being held in the bottom of a well wit" + "h a clown pointing a hose at him"); System.out.println("Clown: 'Say hello!!!'"); System.out.println("Man: H-hello"); System.out.println("Clown: 'ASK HIM!'"); System.out.println("As the clown says this he lower" + "s basket with a small chalkboard in it." ); System.out.println("Man: 'I can add! I can add a lo" + "t of numbers! Give me numbers!"); 1.1 of 2 2014.12.03 14:59:19
  • 33.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/forLoops.java 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 + "t of numbers! Give me numbers!"); dynamicAdding.dynamicAddingKing(); System.out.println("The clown nods and lowers the b" + "ask back into the well"); System.out.println("Clown: 'Put the chalkboard in t" + "he basket'"); System.out.println("Man: 'B-but I like this chalkb." + ".."); System.out.println("Clown: 'PUT THE CHALKBOARD IN T" + "HE D**N BASKET!'"); System.out.println("This reminds you of a movie you" + " saw once, but you can't quite put your " + "finger on it."); System.out.println("You leave."); scan++;//kills loop } catch (Exception e) { System.out.println("Please enter a number"); } } break; case 3: while (scan != 1) { try { System.out.println("You walk into the room and see." + ".. what!"); System.out.println("Dude! It's a dragon! Really!!! " + "Oh my lord! A real Dragon! Super excited" + "."); System.out.println("Clown: 'We taught this dragon t" + "o multiply, go on, give him something to" + " multiply."); multipleMultiplication.multipleMultiplicationKing(); System.out.println("Dragon: 'I use to own the skies" + ", till that blasted dovahkiin inprisoned" + " me here.'"); scan++;//kills loop } catch (Exception e) { System.out.println("Please enter a number"); } } break;//kills loop } } } } 2.1 of 2 2014.12.03 14:59:19
  • 34.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/fToCm.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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.*; class fToCm { private static double height(int feet, int inches) { return (feet * 30.48) + (inches * 2.54); // 1 foot = 30.48 cm // 1 inch = 2.54 cm } public static void fToCmKing() { Scanner in = new Scanner(System.in); int continueLoop = 0; do { // do loop, never liked them. try { System.out.println("Official: 'Enter your height in feet'"); String feetstr = in.nextLine(); int feet = Integer.parseInt(feetstr); if (feet > 0) { System.out.println("Official: 'and how many inches'"); String inchesstr = in.nextLine(); int inches = Integer.parseInt(inchesstr); if (inches > 0) { double result = height(feet, inches); System.out.println("Official: 'you are " + result + " " + "cm tall.'"); continueLoop++; // kills loop } else { throw new NumberFormatException(); } } else { throw new NumberFormatException(); } } catch (NumberFormatException e) { System.out.println("Official: 'Sir, you are not negitive " + "feet tall, and letters are not a hight, stop fooling" + " around.'"); } } while (continueLoop != 1); } } 1.1 of 1 2014.12.03 14:49:03
  • 35.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/iEquals3.java 1 2 3 4 5 6 7 8 9 10 11 12 13 15 16 17 18 19 20 21 22 23 24 25 26 27 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; public class iEquals3 { int i = 0; iEquals3 increment() { i++; return this; } void print() { System.out.println("i = " + i); } } 1.1 of 1 2014.12.03 14:17:35
  • 36.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/idNumber.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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; class idNumber { public static void idNumberKing() { Scanner in = new Scanner(System.in); String input; int num; try { System.out.println("Librarian: 'Out with it, tell me your Id " + "number.'"); num = in.nextInt(); System.out.println("Librarian: 'This is a valid number, good.'"); } catch (Exception e) { System.out.println("Sorry that's not in our system, please leave."); } } } 1.1 of 1 2014.12.03 14:50:17
  • 37.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/inheritance.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 40 41 42 43 44 45 46 47 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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class inheritance { public static void interitanceKing() { int choice = 0, scan; Scanner in = new Scanner(System.in); System.out.println("You see a lawer standing outside"); System.out.println("Lawer: 'Oh good we've been expecting you'"); System.out.println("Lawer: 'So he left you three things. However they a" + "re left through codes."); System.out.println("Lawer: 'The first has to do with the radius of a ci" + "rcle."); System.out.println("Lawer: 'The second has to do with a shopping list"); System.out.println("Lawer: 'The third is just the number 3."); while (choice != 4) { scan = 0; // reset scan at the beginning of every loop System.out.println("Choose 1: Circle, 2: Shopping, 3: 3 or 4: leave" + ""); choice = in.nextInt(); switch (choice) { case 1: while (scan != 1) { try { System.out.println("Lawer: 'oh yes welcome. this wi" + "ll be fast.'"); areaOfCircleAgain.areaOfCircleAgainKing(); System.out.println("Lawer: That is how much money y" + "ou get, good, here you are.'"); System.out.println("He hands you the money."); System.out.println("Lawer: 'get out'"); scan++; // kills loop } catch (Exception e) { System.out.println("Please enter numbers"); } } break; case 2: while (scan != 1) { try { System.out.println("Lawer: 'finally, ok follow my i" + "nstructions exactly please.'"); priceNameWeight.priceNameWeightKing(); System.out.println("Lawer: 'Very good, here you are" + "'"); System.out.println("He hands you the items you aske" + "d for and the amount you asked for'"); System.out.println("Lawer: 'I hate your grandfather" + ", this is just rediculous.'"); scan++; // kills loop } catch (Exception e) { System.out.println("Please enter numbers"); } } break; case 3: while (scan != 1) { try { System.out.println("You walk into a room"); 1.1 of 2 2014.12.03 14:27:08
  • 38.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/inheritance.java 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 System.out.println("You walk into a room"); System.out.println("Lawer: 'you get i dollars.'"); System.out.println("You ask how much is i"); challenge equal = new challenge(); equal.iEquals3King(); System.out.println("Lawer: 'Here are your three dol" + "lars'"); System.out.println("You thank him and leave."); scan++; // kills loop } catch (Exception e) { System.out.println("Please enter numbers"); } } } } } } 2.1 of 2 2014.12.03 14:27:08
  • 39.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/largestArray.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 40 41 42 43 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; import java.util.ArrayList; class largestArray { public static void largestArrayKing() { Scanner in = new Scanner(System.in); ArrayList<Integer> al = new ArrayList<>(); System.out.println("How many numbers will you give him?"); int size = in.nextInt(); System.out.println("tell him " +size +" integers."); // enter that many numbers to the array list while (size-- > 0) { // To add an element to the ArrayList al.add(in.nextInt()); } int max = Integer.MIN_VALUE; // determines largest integer for (Integer i : al) { if (max < i) { max = i; } } System.out.println("Man: The largest value is " + max + "."); } } 1.1 of 1 2014.12.03 14:14:31
  • 40.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/longestArrayPosition.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 40 41 42 43 44 45 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; import java.util.ArrayList; class longestArrayPosition { public static void longestArrayPositionKing() { Scanner in = new Scanner(System.in); ArrayList<Integer> al = new ArrayList<>(); System.out.println("How many numbers would you like to give him?"); int size = in.nextInt(); System.out.println("Tell him" + size + " numbers."); while (size-- > 0) { // To add an element to the ArrayList al.add(in.nextInt()); } int max = Integer.MIN_VALUE; int maxindex = 0; // determines the largest value and location of said value for (int i = 0; i < al.size(); i++) { if (max < al.get(i)) { max = al.get(i); maxindex = i; } } System.out.println("Man: The largest value is " + max + "; which is in " + "slot " + maxindex); } } 1.1 of 1 2014.12.03 14:09:33
  • 41.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/longestString.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 40 41 42 43 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; import java.util.ArrayList; class longestString { public static void longestStringKing() { Scanner in = new Scanner(System.in); System.out.println("How many words would you like to give him?"); int length = in.nextInt(); ArrayList<String> al = new ArrayList<>(); System.out.println("Tell him some words"); for (int i = 0; i <= length; i++) { // To add an element to the ArrayList al.add(in.nextLine()); } int max = Integer.MIN_VALUE; // Determines the entry with the largest number of characters for (String i : al) { if (max < i.length()) { max = i.length(); } } System.out.println("Man: The longest word was " + max + " letters long." + ""); } } 1.1 of 1 2014.12.03 14:12:11
  • 42.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/loops.java 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 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 48 49 50 51 52 53 54 55 56 57 58 59 60 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class loops { public static void loopKing() { Scanner in = new Scanner(System.in); int loops2 = 0, scan; System.out.println("You walk up to the area and two clowns greet you."); System.out.println("One of them brandishes a 'for' on his chest, the ot" + "her has the word 'while' printed on his."); System.out.println("For clown: 'Oh good a traveler come the Circus is t" + "his way.'"); System.out.println("While clown: 'Oh sorry he is mistaken, it's really " + "this way'"); while (loops2 != 3) { scan = 0; // reset scan at the beginning of the loop. System.out.println("Which clown do you with to follow? "); System.out.println("1: While clown, 2: for clown, or 3: Leave."); loops2 = in.nextInt(); switch (loops2) { case 1: while (scan != 1) { try { whileLoops.whileLoopsKing(); scan++; // kills loop } catch (Exception e) { System.out.println("Please enter a number"); } } break; case 2: while (scan != 1) { try { forLoops.forLoopsKing(); scan++; // kills loop } catch (Exception e) { System.out.println("Please enter a number"); } } break; } } } } 1.1 of 1 2014.12.03 15:22:19
  • 43.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/lotteryTicket.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 40 41 42 43 44 45 46 47 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class lotteryTicket { public static void lotteryTicketKing() { Scanner in = new Scanner(System.in); int a = 0, b = 0, c = 0, s, i = 0; while (i != 1) { System.out.println("Enter 3 values from 0 to 2:"); a = in.nextInt(); b = in.nextInt(); c = in.nextInt(); if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { System.out.println("Enter numbers only between 0 and 2."); }else{ i++; // restricts the variables to being between 1 and 2 } } if (a == 2 && b == 2 && c == 2) { //covers all possibilities s = 10; } else if (a == b && b == c) { s = 5; } else if (a != b && c != a) { s = 1; } else { s = 0; } System.out.println("Value of your ticket:" + s); } } 1.1 of 1 2014.12.03 15:07:12
  • 44.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/luckyNumber.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 40 41 42 43 44 45 46 47 48 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class luckyNumber { public static void luckyNumberKing() { String num1, num5; char num2, num7; int num3, num4 = 0, num6 = 0, num8; Scanner in = new Scanner(System.in); System.out.println("Enter Your birthdate(ddmmyy)"); num1 = in.nextLine(); for (int count = 0; count < num1.length(); count++) { num2 = num1.charAt(count); num3 = Character.getNumericValue(num2); num4 = num4 + num3; } /* The code above takes the string and removes each individual character from the string. Then turns it into an int, adds it with the sum of the numbers before it, if no numbers before it adds with 0. It keeps doing this till all numbers have been satisfied*/ num5 = String.valueOf(num4); for (int count = 0; count < num5.length(); count++) { num7 = num5.charAt(count); num8 = Character.getNumericValue(num7); num6 = num6 + num8; } System.out.println("Mey-Rin: 'Your lucky number is " + num6 + ".'"); } } 1.1 of 1 2014.12.03 13:48:47
  • 45.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/methods.java 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 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 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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class methods { public static void methodKing() { Scanner in = new Scanner(System.in); int assassins = 0, scan; System.out.println("You walk up to the dark brotherhood and a man stops" + " you"); System.out.println("Assassin: 'Why have you come here'"); System.out.println("You tell him you're here just to check things out a" + "nd help if you can."); System.out.println("Assassin: 'Oh you're the replacement, wonderful com" + "e along'"); System.out.println("The assassin brings you and sits you down at a desk" + "."); System.out.println("Assassin: 'there is some business thats need to be " + "taken care of, take care of it.'"); System.out.println("You see three folders on the desk, one talks about " + "finding roots, the other talks about division"); System.out.println("the last talks of circles."); while (assassins != 4) { scan = 0; // reset scan at the beginning of the loop System.out.println("Do you want to 1: Do the job about roots, 2:" + " divison, 3: circles, or " + "4: leave?"); assassins = in.nextInt(); switch (assassins) { case 1: while (scan != 1) { try { System.out.println("You walk into a dark room where" + " a man is chained up on the floor"); System.out.println("Assassin: 'We are training him " + "to be an assassin, he must be smart, ask" + " him to give the square root of a number" + "'"); squareRootM.squareRootMKing(); System.out.println("You leave the room, very confus" + "ed."); scan++; } catch (Exception e) { System.out.println("Please enter a number"); } } break; case 2: while (scan != 1) { try { System.out.println("You enter a room and within it " + "you find an assassin pondering over a co" + "mputer"); System.out.println("Assassin: 'Oh good, you're here" + ", I need help. I need to find if two peo" + "ple are related"); System.out.println("Assassin: 'We give all out targ" + "ets numbers and if the numbers divide ev" + "enly, they are related."); 1.1 of 2 2014.12.03 15:21:56
  • 46.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/methods.java 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 + "enly, they are related."); multipleOrNot.multipleOrNotKing(); System.out.println("You leave wondering if you've j" + "ust saved a life."); scan++; } catch (Exception e) { System.out.println("Pleas enter a number!"); } } break; case 3: while (scan != 1) { try { System.out.println("You enter a room and see a man " + "being interrogated by an assassin."); System.out.println("Assassin: 'Oh good, I require y" + "our help, we need to make sure this man " + "is still mentally able, ask him to "); System.out.println("find the area of a circle.'"); areaOfCircle.areaOfCircleKing(); System.out.println("Assassin: 'It seems he is still" + " coherent, thank you friend.'"); System.out.println("You leave the room wondering if" + " you just killed someone."); scan++; } catch (Exception e) { System.out.println("Pleas enter a number!"); } } break; } } } } 2.1 of 2 2014.12.03 15:21:56
  • 47.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/misc.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 40 41 42 43 44 45 46 47 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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class misc { public static void miscKing() { Scanner in = new Scanner(System.in); int scan, miscChoice = 0; System.out.println("You walk down the street and come to a giant ca" + "stle, the sign says 'Phantomhive residence'"); System.out.println("You get greeted by a tall thin man in a black t" + "ux."); System.out.println("Sebastien: 'Hello, I am the butler and servent " + "to my young master Ciel.'"); System.out.println("Sebastien: 'Ciel is busy today but we could use" + " some help, the other butlers are quite incompitent.'"); System.out.println("Sebastien: 'Finnian needs help drawing a circle" + ".'"); System.out.println("Sebastien: 'Baldroy needs help with master Ciel" + "'s math homework.'"); System.out.println("Sebastien: 'May-Rin needs some help teling... f" + "ortunes, i sware I just need to do everything around her" + "e.'"); while (miscChoice != 4) { scan = 0; System.out.println("Choose 1: Drawing circles, 2: math homework " + "3: fortune telling or 4: leave"); miscChoice = in.nextInt(); switch (miscChoice) { case 1: while (scan != 1) { try { System.out.println("You open a door and find papers" + " thrown all over the place and Finnian c" + "rying in the middle of them."); System.out.println("Finnian: 'oh thank god your her" + "e! I need help, I need to finish this pr" + "oject now or master sebastien will be ju" + "st furious with me.'"); System.out.println("Finnian: 'you you please help m" + "e!'"); System.out.println("You nod."); System.out.println("Finnian: 'oh thank you, you're " + "the best! So I need to draw 1/4 of a cir" + "cle in a quadrant but I can't decide whi" + "ch quadrant to draw it in!"); quadOfAngle.quadOfAngleKing(); System.out.println("He is busy drawing and forgets " + "that you exist, you leave the room."); scan++;//kills loop } catch (Exception e) { System.out.println("Please enter a number"); } } break; case 2: while (scan != 1) { try { System.out.println("You walk into a room and see Ba" + "ldroy sititng at a desk next to a white " 1.1 of 2 2014.12.03 14:22:11
  • 48.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/misc.java 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 + "ldroy sititng at a desk next to a white " + "board filled with equations."); System.out.println("Baldroy: 'Gah, I just can't fig" + "gure this problem out!'"); System.out.println("He notices you"); System.out.println("Baldroy: 'Oh good sebastien sen" + "t help! MATE! Over here I need ya!"); System.out.println("You walk over slowly and ask wh" + "at the problem is"); System.out.println("Baldroy: 'I just can't do work " + "alone, I need you to help me out!"); System.out.println("Baldroy: 'I gotta multiply matr" + "icies together but I'm not sure if I rem" + "ember how."); System.out.println("Baldroy: 'Could you give me two" + " matricies and I'll see if I remeber.'"); multiplyMatricies.multiplyMatriciesKing(); System.out.println("Feeling good about helping out " + "you leave in a better mood."); scan++; // kills loop } catch (Exception e) { System.out.println("Please enter a number"); } } break; case 3: while (scan != 1) { try { System.out.println("You walk into a room filled wit" + "h pentagrams and symbols drawn across th" + "e room."); System.out.println("Mey-Rin: 'Oh good! A new custom" + "er it is, it is.'"); System.out.println("Mey-Rin: 'I can tell your fortu" + "ne I can, I can."); System.out.println("Mey-Rin: 'What's your birthday?" + " Tell me and I'll give you a lucky numbe" + "r I will, I will."); luckyNumber.luckyNumberKing(); System.out.println("Mey-Rin: 'Oh that's a good numb" + "er it is, it is."); System.out.println("You leave hurriedly."); scan++; // kills loop } catch (Exception e) { System.out.println("Please enter a number"); } } break; } } } } 2.1 of 2 2014.12.03 14:22:11
  • 49.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/multipleMultiplication.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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class multipleMultiplication { public static void multipleMultiplicationKing() { Scanner in = new Scanner(System.in); // in because patterns int answer; System.out.println("Give the dragon a number:"); int num1 = in.nextInt(); System.out.println("Give the dragon a number of multiples:"); int num2 = in.nextInt(); for (int num3 = 1; num3 <= num2; num3++) { answer = num1 * num3; //multiplies them all together, yay. System.out.println("Dragon: " + num1 + "*" + num3 + "=" + answer); } } } 1.1 of 1 2014.12.03 14:56:37
  • 50.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/multipleOrNot.java 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class multipleOrNot { public static void multipleOrNotKing() { Scanner in = new Scanner(System.in); System.out.println("Assassin: 'Enter the smaller number first please." + "'"); int x = in.nextInt(); System.out.println("Assassin: 'Now the larger one'"); int y = in.nextInt(); System.out.println(multiples(x, y)); } public static boolean multiples(int x, int y) { boolean multiple; if (y % x == 0) { multiple = true; System.out.println("Assassin: 'Hm so it seems they are related, " + "interesting'"); } else { multiple = false; System.out.println("Assassin: 'hm, it seems I've made an error. " + "Thank you friend'"); } return multiple; } } 1.1 of 1 2014.12.03 14:54:14
  • 51.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/multiplicationSimple.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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class multiplicationSimple { public static void multiplicationSimpleKing() { Scanner in = new Scanner(System.in); System.out.println("'Enter the 1st number' the children ask excitedly"); int num1 = in.nextInt(); System.out.println("'Enter the 2nd number' the children ask excitedly"); int num2 = in.nextInt(); int product = num1 * num2; System.out.print("'The product of the two numbers is " + product); System.out.println("' The children shout with excitment."); } } 1.1 of 1 2014.12.03 13:30:14
  • 52.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/multiplyMatricies.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 40 41 42 43 44 45 46 47 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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.*; class multiplyMatricies { public static void multiplyMatriciesKing() { Scanner in = new Scanner(System.in); int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; double num1, num2, num3, num4; // Makes sure the two matricies can be multiplied together while (scan != 1) { System.out.println("Baldroy: 'The first matrix is...'"); row1 = in.nextInt(); System.out.println("Baldroy: 'by...'"); collum1 = in.nextInt(); System.out.println("Baldroy: 'The second matric is...'"); row2 = in.nextInt(); System.out.println("Baldroy: 'by...'"); collum2 = in.nextInt(); if (collum1 == row2) { scan++; } else { System.out.println("The number of collums in matrix one must be" + " equal to the number of rows in matrix 2"); } } double array[][] = new double[row1][collum1]; double array1[][] = new double[row2][collum2]; double array2[][] = new double[row1][collum2]; // fills matrix one for (int row = 0; row < row1; row++) { for (int collum = 0; collum < collum1; collum++) { num1 = row + 1; num2 = collum + 1; System.out.println("1st matrix, value in [" + (int) num1 + "][" + (int) num2 + "]:"); array[row][collum] = in.nextDouble(); } } // fills matrix 2 for (int row = 0; row < row2; row++) { for (int collum = 0; collum < collum2; collum++) { num1 = row + 1; num2 = collum + 1; System.out.println("2nd matrix, value in [" + (int) num1 + "][" + (int) num2 + "]:"); array1[row][collum] = in.nextDouble(); } } // this does the heavy lifting, multiplies the two matricies together. for (int row = 0; row < row1; row++) { for (int collum = 0; collum < collum2; collum++) { num3 = 0; for (int count = 0; count < collum1; count++) { num4 = (array[row][count] * array1[count][collum]); num3 = num3 + num4; } array2[row][collum] = num3; 1.1 of 2 2014.12.03 13:58:03
  • 53.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/multiplyMatricies.java 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 array2[row][collum] = num3; } } System.out.println("Baldroy: 'Product of both matricies is :"); // prints the product of the two matricies for (int row = 0; row < row1; row++) { for (int collum = 0; collum < collum2; collum++) { System.out.print(array2[row][collum] + "t"); } System.out.println(); } System.out.println("'"); System.out.println("Baldroy: 'Yea, I think that's right! Awesome! Thank" + "s little guy!"); } } 2.1 of 2 2014.12.03 13:58:03
  • 54.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/nameBookMail.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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; class nameBookMail { public static void nameBookMailKing() { Scanner in = new Scanner(System.in); // in because patterns author aut; System.out.println("Vader: 'what's your name?'"); String someName = in.nextLine(); System.out.println("Vader: 'what's your email?"); String sEmail = in.nextLine(); System.out.println("Vader: 'Which of my books is this?'"); String sBook = in.nextLine(); aut = new author(); aut.name(someName); // gets name aut.email(sEmail); // gets mail aut.book(sBook); // gets book title System.out.println("The inscription reads:"); System.out.println(aut.name(someName) + "n" + aut.email(sEmail) + "n" + aut.book(sBook)); } } class author { private String name, email, book; public String name(String name) { this.name = name; return name; } public String email(String email) { this.email = email; return email; } public String book(String book) { this.book = book; return book; } } 1.1 of 2 2014.12.03 14:37:45
  • 55.
  • 56.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/numberOfAs.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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class numberOfAs { public static void numberOfAsKing() { Scanner in = new Scanner(System.in); System.out.println("clown: 'Oh please do give me a sentance' "); String str = in.nextLine(); int count = 0; //number of a's int letterInString = 0; //letter in the string while (letterInString < str.length()) { if (str.charAt(letterInString) == 'a') { count++; // counts number of A's } letterInString++; // kills loop } if (count == 0) { // if no A's are in sentance, death scenario System.out.println("Clown: 'There are no A's in this sentance. " + "I told you I like A's!"); System.out.println("The clown takes out a knife as two other " + "clowns grab you from behind and hold you still"); System.out.println("Clown: 'I'll make an A!'"); System.out.println("The clown takes his knife and carves an A so " + "deep in your chest that you bleed to death"); System.out.println("In your last moments you hear this:"); System.out.println("Clown: 'this man gave me a senace with no A's" + " in it, for this I hang him here for all time, as a " + "warning.'"); System.out.println("You died, try again."); } else { // if 1 or more a's in sentance System.out.print("Clown: 'Oh goodie there are " + count); System.out.println(" A's in this sentance, thank you for that, " + "you may go.'"); System.out.println("You leave wondering what would have happened " + "if you had given him a sentance without any A's"); } } } 1.1 of 1 2014.12.03 15:05:12
  • 57.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/operations.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 40 41 42 43 44 45 46 47 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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class operations { public static void operationsKing() { Scanner in = new Scanner(System.in); int center = 0, scan; System.out.println("You walk up to the town hall and a gaurd stops you" ); System.out.println("Gaurd: 'Hault! Who goes there"); System.out.println("You tell him your name and that you're a new advent" + "urer"); System.out.println("Gaurd: 'Oh don't tell me, someone stole your sweet " + "roll'"); System.out.println("You look at him confused, he lets out a large sigh" ); System.out.print("Gaurd: 'Alright"); System.out.println(" Go on inside we have 2 math centers and a temperat" + "ure converter inside, enjoy yourself.'"); System.out.println("You walk inside and see the centers and the convert" + "er."); while (center != 4) { scan = 0; // reset scan at beginning of loop System.out.println("Where would you like to go? 1: math center 1, 2" + ": math center 2, 3: temperature converter, or 4: leave?" ); center = in.nextInt(); switch (center) { case 1: while (scan != 1) { try { System.out.println("You enter the first math center" + " and you see a dog in the corner wagging" + " his tale"); System.out.println("The writing on the wall asks yo" + "u to bark a few times and the dog will r" + "espond in barks"); arithmeticOperations.arithmeticOperationsKing(); System.out.println("While impressive, this is utter" + "ly pointless, you go about your way."); scan++; } catch (Exception e) { System.out.println("Please enter a number"); } } break; case 2: while (scan != 1) { try { System.out.println("You see a single vollyball sitt" + "ing on the floor."); System.out.println("The writing on the wall asks yo" + "u to jump a few times and the ball will " + "respond in bounces"); arithmeticOperations2.arithmeticOperations2King(); System.out.println("You find this odd and unsettlin" + "g, you go about your way."); scan++; } catch (Exception e) { 1.1 of 2 2014.12.03 15:20:14
  • 58.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/operations.java 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 } catch (Exception e) { System.out.println("Please enter a number"); } } break; case 3: while (scan != 1) { try { System.out.println("You see storm from the X-men se" + "ries standing in the middle of the room" + ""); System.out.println("Storm: 'Tell me what temperatur" + "e you want it to be, in celcius, and it " + "shall be so'"); cToF.cToFKing(); System.out.println("You ask storm why she's doing t" + "his instead of saving the world"); System.out.println("She gets upset with your inquir" + "y and knocks you out of the room."); scan++; } catch (Exception e) { System.out.println("Please enter a number"); } } break; } } } } 2.1 of 2 2014.12.03 15:20:14
  • 59.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/palendromeCheck.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 40 41 42 43 44 45 46 47 48 49 50 51 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class palendromeCheck { public static void palendromeCheckKing() { Scanner in = new Scanner(System.in); int length, start = 0, stop, between, i; System.out.print("What word do you give them?"); String line = in.nextLine(); length = line.length(); stop = length - 1; between = (start + stop) / 2; /* scans the beginning and end of a sring to see if it's the same, stops when it gets half way through on both ends*/ for (i = start; i <= between; i++) { if (line.charAt(start) == line.charAt(stop)) { start++; stop--; } else { break; } } if (i == between + 1) { System.out.println("Carl: 'Class, is that a palendrome?'"); System.out.println("Class: 'Yes!'"); } else { System.out.println("Carl: 'Class, is that a palendrome?'"); System.out.println("Class: 'NO!'"); } } } 1.1 of 1 2014.12.03 14:05:54
  • 60.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/priceNameWeight.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 40 41 42 43 44 45 46 47 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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; class priceNameWeight { public static void priceNameWeightKing() { Scanner in = new Scanner(System.in); System.out.println("Lawer: 'Name a product"); String name1 = in.nextLine(); System.out.println("Lawer: 'How much is it worth?"); double up = in.nextDouble(); System.out.println("Lawer: 'How many pounds of it will you be buying?"); double w = in.nextDouble(); WeighedItem item1 = new WeighedItem(); in.nextLine(); System.out.println("Lawer: 'Give me another product'"); String name2 = in.nextLine(); System.out.println("Lawer: 'And it's price per unit?'"); double up1 = in.nextDouble(); System.out.println("Lawer: 'How many of those do you want?'"); int q = in.nextInt(); CountedItem item2 = new CountedItem(); item1.setName(name1); item1.setPrice(up); item1.setWeight(w); item1.getName(); item1.getPrice(); item1.getWeight(); item1.toString(); item2.setName(name2); item2.setPrice(up1); item2.setWeight(q); item2.getName(); item2.getPrice(); item2.getWeight(); item2.toString(); } } class WeighedItem { private double weight; private double price; private String name; private double total; public WeighedItem() { } public void setWeight(double w) { weight = w; } public void setName(String name1) { name = name1; 1.1 of 3 2014.12.03 14:19:35
  • 61.
    73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
  • 62.
  • 63.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/quadOfAngle.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 40 41 42 43 44 45 46 47 48 49 50 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class quadOfAngle { public static void quadOfAngleKing() { int angle = 0, scan = 0; Scanner in = new Scanner(System.in); System.out.println("Finnian: 'Oh! I know, give me an angle in degrees a" + "nd whichever quadrant it's in I'll draw my circle there!"); // restricts the value of imput to between 0 and 360 while (scan != 1) { angle = in.nextInt(); if (angle < 0 || angle > 360) { System.out.println("Finnian: 'Please, only a number between 0 a" + "nd 360.'"); } else { scan++; } } int quadrant = 0; if (angle < 90 && angle > 0) { quadrant = 1; } else if (angle < 180 && angle > 90) { quadrant = 2; } else if (angle < 270 && angle > 180) { quadrant = 3; } else if (angle < 360 && angle > 270) { quadrant = 4; } System.out.println("Finnian: 'That's it! I'm drawing my circle in the " + quadrant + " quadrant!'"); } } 1.1 of 1 2014.12.03 13:59:59
  • 64.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/quadRoot.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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class quadRoot { public static void quadRootKing() { Scanner scan = new Scanner(System.in); System.out.println("What number do you wish the example to be?"); double x = scan.nextDouble(); //x is the intiger/double double sqt = Math.sqrt(x); double quadroot = Math.sqrt(sqt); System.out.print("You explain how the square root is "); System.out.printf("%.5f", sqt); //"%.nf" Is printing a doublt to n decimal places System.out.println(""); //to add a line between result outputs System.out.print("You explain how the quadratic root is "); System.out.printf("%.5f", quadroot); System.out.println(""); } } 1.1 of 1 2014.12.03 15:12:31
  • 65.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/absValue.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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class absValue { public static void absValueKing() { Scanner in = new Scanner(System.in); System.out.println("Which number do you wish to be the example?"); int num1 = in.nextInt(); System.out.println("Which number do you wish to compare the first " + "number to?"); int num2 = in.nextInt(); if (Math.abs(num1) == Math.abs(num2)) { //checks to see if the absolute value of num1 is the same as num2. System.out.println("true, they are absolute values of one a" + "nother."); } else { System.out.println("false, the are not absolute values."); } } } 1.1 of 1 2014.12.03 15:13:46
  • 66.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/smallXLarge.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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class smallXLarge { public static void smallXLargeKing() { Scanner in = new Scanner(System.in); // in because patterns int sum = 0, luck = 50; int a[]; a = new int[10]; System.out.println("woman: 'Alright love, just give me 10 numbers hm?'" + ""); for (int i = 0; i < 10; i++) { // fills the array a[i] = in.nextInt(); } int min = a[0]; int max = a[0]; for (int counter = 1; counter < a.length; counter++) { if (max < a[counter]) { /* if a[counter] is bigger than the number alreasy assigned to max replace max with said value.*/ max = a[counter]; } if (min > a[counter]) {/* if a[counter] is smaller than the number alreasy assigned to min replace min with said value.*/ min = a[counter]; } } System.out.println("Woman: 'Oh the fortune i'm getting is the number " + "" + (max * min)); if (max * min == 0) { System.out.println("Woman: Sorry hun, you're going to die in your s" + "leep tonight."); } else if (max * min < luck && max * min > 0) { System.out.println("Woman: 'Oh my deer boy you have bad luck, but y" + "ou will live into yout 30's, after that the person you l" + "ove most will kill you.'"); } else if (max * min > luck) { System.out.println("Woman: 'Oh you have good luck, I'm glad to see " + "that for once one of the people on this ship aren't goin" + "g to die soon."); } } } 1.1 of 2 2014.12.03 14:30:11
  • 67.
  • 68.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/spaceWeight.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 40 41 42 43 44 45 46 47 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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class spaceWeight { public static void spaceWeightKing() { double weight; int opt; Scanner in = new Scanner(System.in); // in because patterns System.out.print("Please enter your current earth weight. " + "The machine says."); weight = in.nextFloat(); System.out.println(); System.out.println("I have information for the following planets :"); System.out.println("1.Venus 2.Mars 3.Jupiter 4.Saturn 5.Uranus" + " 6.Neptune, which planet are you visiting?"); opt = in.nextInt(); double venus, mars, jupiter, saturn, uranus, neptune; venus = weight * 0.78; // 0.78 is the relitive gravity on venus mars = weight * 0.39; // 0.39 is the relative gravity on mars jupiter = weight * 2.65; // 2.65 is the relative gravity on jupiter saturn = weight * 1.17; // 1.17 is the relative gravity on saturn uranus = weight * 1.05; // 1.05 is the relative gravity on uranus neptune = weight * 1.23; // 1.23 is the relative gravity on neptune switch (opt) { case 1: System.out.println("The little man holds up number cards " + "that read: Your weight in pounds is :" + venus); break; case 2: System.out.println("The little man holds up number cards " + "that read: Your weight in pounds is :" + mars); break; case 3: System.out.println("The little man holds up number cards " + "that read: Your weight in pounds is :" + jupiter); break; case 4: System.out.println("The little man holds up number cards " + "that read: Your weight in pounds is :" + saturn); break; case 5: System.out.println("The little man holds up number cards " + "that read: Your weight in pounds is :" + uranus); break; case 6: System.out.println("The little man holds up number cards " + "that read: Your weight in pounds is :" + neptune); break; } } 1.1 of 2 2014.12.03 15:08:36
  • 69.
  • 70.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/squareRootM.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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class squareRootM { public static double number, answer; public static void calculateSquare(double number) { answer = Math.sqrt(number); System.out.println("The chained man answers: " + (int) answer); System.out.println("Assassin: 'Good, he is ready, thank you.'"); } public static void squareRootMKing() { squareRootM challenge = new squareRootM(); final Scanner in = new Scanner(System.in); System.out.print("Assassin: 'Choose a number'"); number = in.nextDouble(); squareRootM.calculateSquare(number); } } 1.1 of 1 2014.12.03 14:55:54
  • 71.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/stringLength.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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class stringLength { public static void stringLengthKing() { Scanner in = new Scanner(System.in); // in because patterns String enter; int lengths; System.out.println("which word do you want to say?"); enter = in.nextLine(); lengths = enter.length(); System.out.println("Daryl: 'hm, that's about" + lengths + " long.'"); } } 1.1 of 1 2014.12.03 14:07:44
  • 72.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/strings.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 40 41 42 43 44 45 46 47 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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class strings { public static void stringsKing() { Scanner in = new Scanner(System.in); int scan, stringchoice = 0; System.out.println("Lady: 'Oh, yes hello. Welcome to this here humb" + "le farm. Would you be interested in some work pumpkin?"); System.out.println("Lady: 'okay well, daryl needs help with measuri" + "ng how long of a shot he needs to take.'"); System.out.println("Lady: 'Rick needs help learning how to yell.'"); System.out.println("Lady: 'and carl needs help in the classroom."); while (stringchoice != 4) { scan = 0; // reset scan at beginning of loop System.out.println("Choose 1: measuring length, 2: yelling, 3: clas" + "sroom, or 4: leave"); stringchoice = in.nextInt(); switch (stringchoice) { case 1: while (scan != 1) { try { System.out.println("You walk up and see Daryl lying" + " ontop of a truck with his sniper."); System.out.println("Daryl: 'hey there kid, carol se" + "nt you here to help me right?'"); System.out.println("Daryl: 'just say something and " + "I'll work out how long the word is, soun" + "ds weird but it helps me'"); stringLength.stringLengthKing(); System.out.println("Daryl: 'thanks kid, move along." + "'"); System.out.println("You leave."); scan++; // kills loop } catch (Exception e) { System.out.println("Please enter a string"); } } break; case 2: while (scan != 1) { try { System.out.println("You walk up and see rick runnin" + "g around frantically."); System.out.println("Rick: 'have you seen Carl? I ca" + "n't find him anywhere!'"); System.out.println("Rick: 'carl?'"); System.out.println("Rick: 'I've been having some tr" + "ouble yelling lately, could you help?'"); System.out.println("Rick: 'Tell me something to yel" + "l.'"); toUpperCase.toUpperCaseKing(); System.out.println("Rick: 'I still can't find him, " + "but thanks anyway.'"); System.out.println("You leave, confused."); scan++; //kills loop } catch (Exception e) { System.out.println("Please enter a string"); } } 1.1 of 2 2014.12.03 14:22:27
  • 73.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/strings.java 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 } break; case 3: while (scan != 1) { try { System.out.println("You walk up to a school house a" + "nd see a young man standing infront of a" + " chalk board and the name 'carl' written" + " behind him."); System.out.println("Carl: 'Oh hey there, I'm teachi" + "ng these kids about palendromes today, c" + "an you help us out."); System.out.println("You nod"); System.out.println("Give us a word and we'll see if" + " it's a palendrome or not."); palendromeCheck.palendromeCheckKing(); System.out.println("Carl: 'Good job, thanks for you" + "r help.'"); System.out.println("You leave, it's weird, carl is " + "actually in the house this time."); scan++; // kills loop } catch (Exception e) { System.out.println("Please enter a string"); } } break; } } } } 2.1 of 2 2014.12.03 14:22:27
  • 74.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/tOrF.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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class tOrF { public static void tOrFKing() { Scanner in = new Scanner(System.in); System.out.println("Architecht: 'What is 12+12?'"); int answer; answer = in.nextInt(); System.out.print(answer == 24 ? "True" : "False"); //compressed if if (answer == 24) { System.out.println("Architect: 'Good job, you may stay'"); System.out.println("The door behind you slowly opens, you leave"); } else { // you did math incorrectly, death scenario System.out.println("Architect: 'You chose, poorly.'"); System.out.println("The Architect dissapears and the room starts " + "filling with darkness."); System.out.println("You hear voices speak in the dark"); System.out.println("Voices: 'We are so hungry'"); System.out.println("The last bit of light turns to darkness and " + "you are eaten alive by the voices."); System.out.println("You died, try again."); } } } 1.1 of 1 2014.12.03 15:06:21
  • 75.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/toUpperCase.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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class toUpperCase { public static void toUpperCaseKing() { Scanner in = new Scanner(System.in); System.out.print("What do you tell him?"); // capitalizes the input String line = in.nextLine().toUpperCase(); System.out.println("Rick: '" + line); } } 1.1 of 1 2014.12.03 14:07:27
  • 76.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/tryNCatch.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 40 41 42 43 44 45 46 47 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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class tryNCatch { public static void tryNCatchKing() { Scanner in = new Scanner(System.in); int StPigeonations = 0; // 100 points if you get the reference int scan; System.out.println("You enter the library and find a man sitting at a " + "desk"); System.out.println("Man: 'Yes hello, welcome to the library we are " + "undergoing renovations, only two rooms are available."); while (StPigeonations != 4) { scan = 0; System.out.println("Do you want to enter the 1:Id card office, " + "2:The height converter 3:go into a closed off room or " + "4:leave"); StPigeonations = in.nextInt(); switch (StPigeonations) { case 1: while (scan != 1) { try { System.out.println("You enter the Id card issuer an" + "d a librarian looks up at you."); System.out.println("Librarian: 'Oh god another one," + " okay come along I need some information" + " from you."); System.out.println("Librarian: 'First, what is you " + "Id number?'"); System.out.println("As you have not been issued one" + " you look confused"); System.out.println("Librarian: 'Come along, the Id " + "number, it's 10 or less numbers long."); System.out.println("You stare blankly and start to " + "make up an Id number to give her hoping " + "it's real."); idNumber.idNumberKing(); System.out.println("You walk out of the building."); scan++; // kills loop } catch (Exception e) { System.out.println("Please enter a number"); } } break; case 2: while (scan != 1) { try { System.out.println("You enter a room and see a very" + " official looking man"); fToCm.fToCmKing(); System.out.println("Official: 'Thank you sir, you m" + "ay go'"); scan++; // kills loop } catch (Exception e) { System.out.println("Please enter numbers"); } } break; case 3: 1.1 of 2 2014.12.03 14:49:59
  • 77.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/tryNCatch.java 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 case 3: while (scan != 1) { try { System.out.println("You sneak past the man and thro" + "ugh a door reading 'do not pass'"); System.out.println("you enter a room and see a youn" + "g boy standing quietly in the corner."); System.out.println("You say hello, slightly scared"); System.out.println("Boy: !... 'You shouldn't be in " + "here'"); System.out.println("You ask him why he's in here"); System.out.println("Boy: 'I like it here. It's quie" + "t"); System.out.println("You ask him name"); System.out.println("Boy: 'Ne.. Negeki'"); System.out.println("You greet him warmly and go to " + "shake his hand, he backs away quickly"); System.out.println("Negeki: 'You can't touch me... " + "We can play a game though, do you want t" + "o play?'"); System.out.println("You nod."); System.out.println("Negeki: 'Okay, I'm thinking of " + "multiple numbers, you only need to guess" + " one of them it's divisable by 2 and one" + " other number."); chooseANumber.chooseANumberKing(); scan++; // kills loop } catch (Exception e) { System.out.println("Please enter a number"); } } break; } } } } 2.1 of 2 2014.12.03 14:49:59
  • 78.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/variableSection.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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class variableSection { public static void variableking() { Scanner in = new Scanner(System.in); int scan, building = 0; System.out.println("You have chosen the land of variable knowldge"); System.out.println("You enter the town and you see the school house whe" + "re the children learn multiplication."); System.out.println("You also see the factory where the workers create t" + "hese things called, variables."); System.out.println("Lastly you see the export building, where they sepe" + "rate between even and odd."); while (building != 4) { scan = 0; System.out.println("Which building would you like to visit? 1: The" + " school, 2: The factory, 3: Exports or 4: leave?"); building = in.nextInt(); switch (building) { case 1: while (scan != 1) { try { System.out.println("The kids ask you to give them 2" + " numbers to multiply."); multiplicationSimple.multiplicationSimpleKing(); System.out.println("The children thank you and you " + "go about your way."); scan++; } catch (Exception e) { System.out.println("Pleas enter a number!"); } } break; case 2: while (scan != 1) { try { System.out.println("You enter the factory and see " + "the CFO of the factory run up to you"); System.out.println("CFO: 'Oh thank god you've arriv" + "ed, we need you to test the machine!'"); System.out.println("He says and quickly grabs you b" + "uy the hand and drags you to the machin" + "e"); System.out.println("CFO: 'just follow the instructi" + "ons on the screen'"); declareVariable.declareVariableKing(); System.out.println("CFO: 'Oh it's working, wonderfu" + "l. Thank you for your time."); System.out.println("They escort you out of the fact" + "ory and you go about your way."); scan++; } catch (Exception e) { System.out.println("Pleas enter a number!"); } } break; case 3: while (scan != 1) { try { 1.1 of 2 2014.12.03 13:26:55
  • 79.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/variableSection.java try { System.out.println("You enter the export factory, m" + "istaken for a worker, and immediately pu" + "t to work."); System.out.println("Worker: 'Just enter numbers and" + " the machine spits out an answer'"); evenOrOdd.evenOrOddKing(); System.out.println("Worker: 'Good job, but we're ov" + "erstaffed, get out.'"); System.out.println("They kick you out of the buildi" + "ng and you go about your way."); System.out.println("'Thanks obama' You think."); scan++; } catch (Exception e) { System.out.println("Pleas enter a number!"); } } break; } } } } 2.1 of 2 2014.12.03 13:26:55
  • 80.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/upOrDown.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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class upOrDown { public static void upOrDownKing() { Scanner in = new Scanner(System.in); System.out.println("Which number do you wish to be the example? " + "preferably a decimal"); double dob = in.nextDouble(); int up = (int) Math.ceil(dob); int down = (int) Math.floor(dob); // math opperations need math.X(N) System.out.println("You explain how rounding this number up gets " + "you " + up); System.out.println("You explain how rounding this number down gets " + "you " + down); } } 1.1 of 1 2014.12.03 15:13:27
  • 81.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/whileLoops.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 40 41 42 43 44 45 46 47 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 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; public class whileLoops { public static void whileLoopsKing() { Scanner in = new Scanner(System.in); int circus = 0; int scan = 0; System.out.println("You walk into the while tent and see all manner of " + "creatures. A clown approaches you."); System.out.println("Clown: 'I am so sorry dear patron but only three of" + " our exhibits are open today. The letter counter, box game, " + "and adding game."); while (circus != 4) { scan = 0; System.out.println("Do you want to play 1: the letter counter, 2: t" + "he box game, 3: the adding game, or 4: leave?"); circus = in.nextInt(); switch (circus) { case 1: while (scan != 1) { try { System.out.println("Clown: 'Hello! Oh how I do love" + " the letter A. Give me a sentance I'll t" + "ell you how many times A appears in it!" + ""); numberOfAs.numberOfAsKing(); scan++; // kills loop } catch (Exception e) { System.out.println("Please enter a number"); } } break; case 2: while (scan != 1) { try { System.out.println("You enter the room and see a ra" + "ther annoyed looking clown."); System.out.println("Clown: 'yes welcome to the box " + "game I just need a little info from you " + "to play.'"); System.out.println("You ask why the clown sounds so" + " annoyed."); System.out.println("Clown: 'Just answer the questio" + "ns and you'll see.'"); boxOfNumbers.boxOfNumbersKing(); System.out.println("Clown: 'Do you see how pointles" + "s that was, this is what i do all day ev" + "ery day.'"); System.out.println("Beofre you can ask the clown wh" + "y he doesn't quit he says:"); System.out.println("Clown: 'Just leave there's 20 m" + "ore people behind you.'"); scan++; // kills loop } catch (Exception e) { System.out.println("Please enter a number"); } } 1.1 of 2 2014.12.03 15:05:32
  • 82.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/whileLoops.java 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 } break; case 3: while (scan != 1) { try { System.out.println("You walk into the room and find" + " a clown with a clip board standing in t" + "he room."); System.out.println("Clown: 'Yes come along I have a" + " few questions before the game can begin" + ".'"); addingFiveIntegers.addingFiveIntegersKing(); System.out.println("Before you can bring up that th" + "is wasn't a game he kicks you out of his" + " tent."); scan++; // kills loop } catch (Exception e) { System.out.println("Please enter a number"); } } break; } } } } 2.1 of 2 2014.12.03 15:05:32
  • 83.
    /Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/xAndY.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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 //********************************************************** // Assignment: Final Project // // Author: Andrew D. MacKoul // // Completion time: ≈ 12 hours // // Honor Code: I pledge that this program represents my own // program code. I received help from Prof. Vanselow // in designing and debugging my program. //********************************************************* package finale; import java.util.Scanner; class xAndY { public static void xAndYKing() { Scanner in = new Scanner(System.in); System.out.println("Soldier: 'Enter x coordinate'"); int num1 = in.nextInt(); System.out.println("Soldier: 'Enter y coordinate'"); int num2 = in.nextInt(); Point point = new Point(num1, num2); System.out.println("Soldier: 'It's in quadrant " + point.quadrant() + "" + "'"); } } class Point { private int x, y; public Point(int num1, int num2) { x = num1; y = num2; } public int quadrant() { // determines the quadrant int quadrant = 0; if (x > 0 && y > 0) { quadrant = 1; } else if (x < 0 && y > 0) { quadrant = 2; } else if (x < 0 && y < 0) { quadrant = 3; } else if (x > 0 && y < 0) { quadrant = 4; } else if (x == 0 || y == 0) { System.out.println("This is on an axis."); } return quadrant; } } 1.1 of 1 2014.12.03 14:34:50