83
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 w // in designing and debugging my program. //********************************************************* package f finale e; import java. . .util l. .Random m; import j java. . .util l. .Scanner r; public c class s Finale { public s static c void d main(S String g[ [] ] args s) ) { i int crash h = = 0 0; / // Introduction is outside the loop so it doesn't repeat when you fail. i introduction n.introductionking( () ); w while e ( (crash h != = 1 ) { { crash h = = 0 0; try y { Finale e.finaleKing( (args s) ); crash h++ +; ;//kills the program } } catch h ( (Exception e e e) ) { System m.out.p println n( (" "Please enter the number of the road you wi i" + "s sh to travel down. " ); ; } } } } public s static c void d finaleKing( (String g[ [] ] args) ) { { S Scanner r in n = = new w Scanner r( (System m.in) ); ; i int option n, , scan n, randomNum m, , choosenum ; i int loopkill l = = 0 0; w while e ( (loopkill l != 1 1) ) { { scan n = = 0 0; Random m rn n = = new R Random m( () ); int t n n = = 15 5 - - 2 + + 1 1; ; int t i i = = rn n. .nextInt( () ) ) % % n n; randomNum m = = 1 + i i; ; choosenum m = = Math. .abs( randomNum m) ); if f ( (choosenum == 0 0) ) { choosenum ++; ; } System m.out. .println( (" " "You have 6 roads infront of you. ." ) ; System m.out. .println( (" " "1: The first road leads to the land of" " + + " " variable knowledge. ." ") ; System m.out. .println( (" " "2: The second road leads to the town hall " + + " "where the king conducts his operations. ." ") ); System m.out. .println( (" " "3: The third road leads to the land of " " + + " "'arithmos' meaning arithmetic in greek. ." ") ); System m.out. .println( (" " "4: The fourth road leads to our water sourc c" + + " "e, they control the flow of resources for the land. ." + + "" ") ; System m.out. .println( (" " "5: The fifth road leads to the circus, many y" + + " " fun rides there, they just go in circles till you " + + " "stop them. ." ") ); System m.out. .println( (" " "6: This road leads to the dark brotherhood d" + + " ", they are assassins, their methods are.... " + + " " questionable. ." ") ); System m.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 m.out. .println( (" " "8: This road leads to a starship that's the siz z" + + + " "e "e of a small class 4 moon, we call it, The Death Star." .") "); ); .1 of 4 2014.12.03 15:28:22

Text adventure

Embed Size (px)

Citation preview

Page 1: Text adventure

123456789101112131415161718192021222324252627282930

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Random;import java.util.Random;import java.util.Random;import java.util.Random;import java.util.Random;import java.util.Random;import java.util.Random;import java.util.Random;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class Finale { {

public static void public static void public static void public static void public static void public static void public static void main(String[] args) {(String[] args) {(String[] args) {(String[] args) {(String[] args) {(String[] args) {(String[] args) {(String[] args) {(String[] args) { int crash = 0; int crash = 0; int crash = 0; int crash = 0; int crash = 0; int crash = 0; int crash = 0; int crash = 0; int crash = 0; // Introduction is outside the loop so it doesn't repeat when you fail. // Introduction is outside the loop so it doesn't repeat when you fail. introduction. introduction. introduction.introductionking();();(); while (crash != 1) { while (crash != 1) { while (crash != 1) { while (crash != 1) { while (crash != 1) { while (crash != 1) { while (crash != 1) { while (crash != 1) { while (crash != 1) { while (crash != 1) { while (crash != 1) { while (crash != 1) { crash = 0; crash = 0; crash = 0; crash = 0; crash = 0; crash = 0; crash = 0; try { try { try { try { Finale. Finale. Finale.finaleKing(args);(args);(args);(args); crash++;//kills the program crash++;//kills the program crash++;//kills the program crash++;//kills the program crash++;//kills the program } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter the number of the road you wi".println("Please enter the number of the road you wi".println("Please enter the number of the road you wi".println("Please enter the number of the road you wi".println("Please enter the number of the road you wi".println("Please enter the number of the road you wi" + "sh to travel down."); + "sh to travel down."); + "sh to travel down."); + "sh to travel down."); + "sh to travel down."); + "sh to travel down."); + "sh to travel down."); + "sh to travel down."); } } } } } }

public static void public static void public static void public static void public static void public static void public static void finaleKing(String[] args) {(String[] args) {(String[] args) {(String[] args) {(String[] args) {(String[] args) {(String[] args) {(String[] args) {(String[] args) { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in); ); ); int option, scan, randomNum, choosenum; int option, scan, randomNum, choosenum; int option, scan, randomNum, choosenum; int option, scan, randomNum, choosenum; int option, scan, randomNum, choosenum; int option, scan, randomNum, choosenum; int option, scan, randomNum, choosenum; int option, scan, randomNum, choosenum; int option, scan, randomNum, choosenum; int option, scan, randomNum, choosenum; int option, scan, randomNum, choosenum; int option, scan, randomNum, choosenum; int option, scan, randomNum, choosenum; int option, scan, randomNum, choosenum; int loopkill = 0; int loopkill = 0; int loopkill = 0; int loopkill = 0; int loopkill = 0; int loopkill = 0; int loopkill = 0; int loopkill = 0; int loopkill = 0; int loopkill = 0;

while (loopkill != 1) { while (loopkill != 1) { while (loopkill != 1) { while (loopkill != 1) { while (loopkill != 1) { while (loopkill != 1) { while (loopkill != 1) { while (loopkill != 1) { while (loopkill != 1) { while (loopkill != 1) { while (loopkill != 1) { while (loopkill != 1) { while (loopkill != 1) { scan = 0; scan = 0; scan = 0; scan = 0; scan = 0; scan = 0; scan = 0;

Random rn = new Random(); Random rn = new Random(); Random rn = new Random(); Random rn = new Random(); Random rn = new Random(); Random rn = new Random(); Random rn = new Random(); Random rn = new Random(); Random rn = new Random(); Random rn = new Random(); Random rn = new Random(); Random rn = new Random(); Random rn = new Random(); int n = 15 - 2 + 1; int n = 15 - 2 + 1; int n = 15 - 2 + 1; int n = 15 - 2 + 1; int n = 15 - 2 + 1; int n = 15 - 2 + 1; int n = 15 - 2 + 1; int n = 15 - 2 + 1; int n = 15 - 2 + 1; int n = 15 - 2 + 1; int n = 15 - 2 + 1; int n = 15 - 2 + 1; int n = 15 - 2 + 1; int n = 15 - 2 + 1; int n = 15 - 2 + 1; int n = 15 - 2 + 1; int n = 15 - 2 + 1; int i = rn.nextInt() % n; int i = rn.nextInt() % n; int i = rn.nextInt() % n; int i = rn.nextInt() % n; int i = rn.nextInt() % n; int i = rn.nextInt() % n; int i = rn.nextInt() % n; int i = rn.nextInt() % n; int i = rn.nextInt() % n; int i = rn.nextInt() % n; int i = rn.nextInt() % n; int i = rn.nextInt() % n; int i = rn.nextInt() % n; int i = rn.nextInt() % n; int i = rn.nextInt() % n; int i = rn.nextInt() % n; int i = rn.nextInt() % n; randomNum = 1 + i; randomNum = 1 + i; randomNum = 1 + i; randomNum = 1 + i; randomNum = 1 + i; randomNum = 1 + i; randomNum = 1 + i; randomNum = 1 + i; randomNum = 1 + i; randomNum = 1 + i; randomNum = 1 + i; choosenum = Math. choosenum = Math. choosenum = Math. choosenum = Math. choosenum = Math. choosenum = Math. choosenum = Math.abs(randomNum);(randomNum);(randomNum);(randomNum); if (choosenum == 0) { if (choosenum == 0) { if (choosenum == 0) { if (choosenum == 0) { if (choosenum == 0) { if (choosenum == 0) { if (choosenum == 0) { if (choosenum == 0) { if (choosenum == 0) { if (choosenum == 0) { if (choosenum == 0) { if (choosenum == 0) { choosenum++; choosenum++; choosenum++; choosenum++; } }

System. System. System.out.println("You have 6 roads infront of you.");.println("You have 6 roads infront of you.");.println("You have 6 roads infront of you.");.println("You have 6 roads infront of you.");.println("You have 6 roads infront of you.");.println("You have 6 roads infront of you.");.println("You have 6 roads infront of you.");.println("You have 6 roads infront of you."); System. System. System.out.println("1: The first road leads to the land of".println("1: The first road leads to the land of".println("1: The first road leads to the land of".println("1: The first road leads to the land of".println("1: The first road leads to the land of".println("1: The first road leads to the land of" + " variable knowledge."); + " variable knowledge."); + " variable knowledge."); + " variable knowledge."); + " variable knowledge."); + " variable knowledge."); + " variable knowledge."); + " variable knowledge."); System. System. System.out.println("2: The second road leads to the town hall ".println("2: The second road leads to the town hall ".println("2: The second road leads to the town hall ".println("2: The second road leads to the town hall ".println("2: The second road leads to the town hall ".println("2: The second road leads to the town hall " + "where the king conducts his operations."); + "where the king conducts his operations."); + "where the king conducts his operations."); + "where the king conducts his operations."); + "where the king conducts his operations."); + "where the king conducts his operations."); + "where the king conducts his operations."); + "where the king conducts his operations."); System. System. System.out.println("3: The third road leads to the land of ".println("3: The third road leads to the land of ".println("3: The third road leads to the land of ".println("3: The third road leads to the land of ".println("3: The third road leads to the land of ".println("3: The third road leads to the land of " + "'arithmos' meaning arithmetic in greek."); + "'arithmos' meaning arithmetic in greek."); + "'arithmos' meaning arithmetic in greek."); + "'arithmos' meaning arithmetic in greek."); + "'arithmos' meaning arithmetic in greek."); + "'arithmos' meaning arithmetic in greek."); + "'arithmos' meaning arithmetic in greek."); + "'arithmos' meaning arithmetic in greek."); System. System. System.out.println("4: The fourth road leads to our water sourc".println("4: The fourth road leads to our water sourc".println("4: The fourth road leads to our water sourc".println("4: The fourth road leads to our water sourc".println("4: The fourth road leads to our water sourc".println("4: The fourth road leads to our water sourc" + "e, they control the flow of resources for the land." + "e, they control the flow of resources for the land." + "e, they control the flow of resources for the land." + "e, they control the flow of resources for the land." + "e, they control the flow of resources for the land." + "e, they control the flow of resources for the land." + ""); + ""); + ""); + ""); + ""); + ""); System. System. System.out.println("5: The fifth road leads to the circus, many".println("5: The fifth road leads to the circus, many".println("5: The fifth road leads to the circus, many".println("5: The fifth road leads to the circus, many".println("5: The fifth road leads to the circus, many".println("5: The fifth road leads to the circus, many" + " fun rides there, they just go in circles till you " + " fun rides there, they just go in circles till you " + " fun rides there, they just go in circles till you " + " fun rides there, they just go in circles till you " + " fun rides there, they just go in circles till you " + " fun rides there, they just go in circles till you " + "stop them."); + "stop them."); + "stop them."); + "stop them."); + "stop them."); + "stop them."); + "stop them."); + "stop them."); System. System. System.out.println("6: This road leads to the dark brotherhood".println("6: This road leads to the dark brotherhood".println("6: This road leads to the dark brotherhood".println("6: This road leads to the dark brotherhood".println("6: This road leads to the dark brotherhood".println("6: This road leads to the dark brotherhood" + ", they are assassins, their methods are...." + ", they are assassins, their methods are...." + ", they are assassins, their methods are...." + ", they are assassins, their methods are...." + ", they are assassins, their methods are...." + ", they are assassins, their methods are...." + " questionable."); + " questionable."); + " questionable."); + " questionable."); + " questionable."); + " questionable."); + " questionable."); + " questionable."); System. System. System.out.println("7: This road leads to the library, their ".println("7: This road leads to the library, their ".println("7: This road leads to the library, their ".println("7: This road leads to the library, their ".println("7: This road leads to the library, their ".println("7: This road leads to the library, their " + "most famous book is The Catcher In The Try. I feel " + "most famous book is The Catcher In The Try. I feel " + "most famous book is The Catcher In The Try. I feel " + "most famous book is The Catcher In The Try. I feel " + "most famous book is The Catcher In The Try. I feel " + "most famous book is The Catcher In The Try. I feel " + "like I said that wrong."); + "like I said that wrong."); + "like I said that wrong."); + "like I said that wrong."); + "like I said that wrong."); + "like I said that wrong."); + "like I said that wrong."); + "like I said that wrong."); System. System. System.out.println("8: This road leads to a starship that's the siz".println("8: This road leads to a starship that's the siz".println("8: This road leads to a starship that's the siz".println("8: This road leads to a starship that's the siz".println("8: This road leads to a starship that's the siz".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."); + "e of a small class 4 moon, we call it, The Death Star."); + "e of a small class 4 moon, we call it, The Death Star."); + "e of a small class 4 moon, we call it, The Death Star."); + "e of a small class 4 moon, we call it, The Death Star."); + "e of a small class 4 moon, we call it, The Death Star."); + "e of a small class 4 moon, we call it, The Death Star."); + "e of a small class 4 moon, we call it, The Death Star.");

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/Finale.java

1.1 of 4 2014.12.03 15:28:22

Page 2: Text adventure

30

System. System. System.out.println("9: This leads to a pirate ship that is enhabite".println("9: This leads to a pirate ship that is enhabite".println("9: This leads to a pirate ship that is enhabite".println("9: This leads to a pirate ship that is enhabite".println("9: This leads to a pirate ship that is enhabite".println("9: This leads to a pirate ship that is enhabite" + "d by 80's people. They constantly spout out: 'Arr... eee" + "d by 80's people. They constantly spout out: 'Arr... eee" + "d by 80's people. They constantly spout out: 'Arr... eee" + "d by 80's people. They constantly spout out: 'Arr... eee" + "d by 80's people. They constantly spout out: 'Arr... eee" + "d by 80's people. They constantly spout out: 'Arr... eee" + "ey!'"); + "ey!'"); + "ey!'"); + "ey!'"); + "ey!'"); + "ey!'"); + "ey!'"); + "ey!'"); System. System. System.out.println("10: Your grandad died, he left you some inherit".println("10: Your grandad died, he left you some inherit".println("10: Your grandad died, he left you some inherit".println("10: Your grandad died, he left you some inherit".println("10: Your grandad died, he left you some inherit".println("10: Your grandad died, he left you some inherit" + "ance, go down this road to receive your inheritance."); + "ance, go down this road to receive your inheritance."); + "ance, go down this road to receive your inheritance."); + "ance, go down this road to receive your inheritance."); + "ance, go down this road to receive your inheritance."); + "ance, go down this road to receive your inheritance."); + "ance, go down this road to receive your inheritance."); + "ance, go down this road to receive your inheritance."); System. System. System.out.println("11: Your being taxed and need to go to the coll".println("11: Your being taxed and need to go to the coll".println("11: Your being taxed and need to go to the coll".println("11: Your being taxed and need to go to the coll".println("11: Your being taxed and need to go to the coll".println("11: Your being taxed and need to go to the coll" + "ections office, sorry. follow this road to pay your bill" + "ections office, sorry. follow this road to pay your bill" + "ections office, sorry. follow this road to pay your bill" + "ections office, sorry. follow this road to pay your bill" + "ections office, sorry. follow this road to pay your bill" + "ections office, sorry. follow this road to pay your bill" + "s."); + "s."); + "s."); + "s."); + "s."); + "s."); + "s."); + "s."); System. System. System.out.println("12: This leads to the farms, best known for sow".println("12: This leads to the farms, best known for sow".println("12: This leads to the farms, best known for sow".println("12: This leads to the farms, best known for sow".println("12: This leads to the farms, best known for sow".println("12: This leads to the farms, best known for sow" + "ing strings to make fabric."); + "ing strings to make fabric."); + "ing strings to make fabric."); + "ing strings to make fabric."); + "ing strings to make fabric."); + "ing strings to make fabric."); + "ing strings to make fabric."); + "ing strings to make fabric."); System. System. System.out.println("13: This leads to the other road, we don't talk".println("13: This leads to the other road, we don't talk".println("13: This leads to the other road, we don't talk".println("13: This leads to the other road, we don't talk".println("13: This leads to the other road, we don't talk".println("13: This leads to the other road, we don't talk" + " about it, it's weird."); + " about it, it's weird."); + " about it, it's weird."); + " about it, it's weird."); + " about it, it's weird."); + " about it, it's weird."); + " about it, it's weird."); + " about it, it's weird."); System. System. System.out.println("14: Random.");.println("14: Random.");.println("14: Random.");.println("14: Random.");.println("14: Random.");.println("14: Random.");.println("14: Random.");.println("14: Random."); System. System. System.out.println("15: Or you may turn around and go home.");.println("15: Or you may turn around and go home.");.println("15: Or you may turn around and go home.");.println("15: Or you may turn around and go home.");.println("15: Or you may turn around and go home.");.println("15: Or you may turn around and go home.");.println("15: Or you may turn around and go home.");.println("15: Or you may turn around and go home."); System. System. System.out.println("Which road do you chose? Enter a number.");.println("Which road do you chose? Enter a number.");.println("Which road do you chose? Enter a number.");.println("Which road do you chose? Enter a number.");.println("Which road do you chose? Enter a number.");.println("Which road do you chose? Enter a number.");.println("Which road do you chose? Enter a number.");.println("Which road do you chose? Enter a number."); option = in.nextInt(); option = in.nextInt(); option = in.nextInt(); option = in.nextInt(); option = in.nextInt(); option = in.nextInt(); option = in.nextInt(); option = in.nextInt(); option = in.nextInt(); option = in.nextInt(); option = in.nextInt(); if (option == 14) { if (option == 14) { if (option == 14) { if (option == 14) { if (option == 14) { if (option == 14) { if (option == 14) { if (option == 14) { if (option == 14) { if (option == 14) { if (option == 14) { if (option == 14) { option = choosenum; option = choosenum; option = choosenum; option = choosenum; option = choosenum; option = choosenum; option = choosenum; } } if (option == 1) { if (option == 1) { if (option == 1) { if (option == 1) { if (option == 1) { if (option == 1) { if (option == 1) { if (option == 1) { if (option == 1) { if (option == 1) { if (option == 1) { if (option == 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { variableSection. variableSection. variableSection.variableking();();();

scan++; scan++; scan++; scan++; } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number."); } } } } } else if (option == 2) { } else if (option == 2) { } else if (option == 2) { } else if (option == 2) { } else if (option == 2) { } else if (option == 2) { } else if (option == 2) { } else if (option == 2) { } else if (option == 2) { } else if (option == 2) { } else if (option == 2) { } else if (option == 2) { } else if (option == 2) { } else if (option == 2) { } else if (option == 2) { } else if (option == 2) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { operations. operations. operations.operationsKing();();();

scan++; scan++; scan++; scan++; } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number."); } } } } } else if (option == 3) { } else if (option == 3) { } else if (option == 3) { } else if (option == 3) { } else if (option == 3) { } else if (option == 3) { } else if (option == 3) { } else if (option == 3) { } else if (option == 3) { } else if (option == 3) { } else if (option == 3) { } else if (option == 3) { } else if (option == 3) { } else if (option == 3) { } else if (option == 3) { } else if (option == 3) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { arithmatic. arithmatic. arithmatic.arithmaticKing();();();

scan++; scan++; scan++; scan++; } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number."); } } } } } else if (option == 4) { } else if (option == 4) { } else if (option == 4) { } else if (option == 4) { } else if (option == 4) { } else if (option == 4) { } else if (option == 4) { } else if (option == 4) { } else if (option == 4) { } else if (option == 4) { } else if (option == 4) { } else if (option == 4) { } else if (option == 4) { } else if (option == 4) { } else if (option == 4) { } else if (option == 4) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { flowControl. flowControl. flowControl.flowControlKing();();(); scan++; scan++; scan++; scan++; } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number."); } } } } } else if (option == 5) { } else if (option == 5) { } else if (option == 5) { } else if (option == 5) { } else if (option == 5) { } else if (option == 5) { } else if (option == 5) { } else if (option == 5) { } else if (option == 5) { } else if (option == 5) { } else if (option == 5) { } else if (option == 5) { } else if (option == 5) { } else if (option == 5) { } else if (option == 5) { } else if (option == 5) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { loops. loops. loops.loopKing();();(); scan++; scan++; scan++; scan++; } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number."); } } } } } else if (option == 6) { } else if (option == 6) { } else if (option == 6) { } else if (option == 6) { } else if (option == 6) { } else if (option == 6) { } else if (option == 6) { } else if (option == 6) { } else if (option == 6) { } else if (option == 6) { } else if (option == 6) { } else if (option == 6) { } else if (option == 6) { } else if (option == 6) { } else if (option == 6) { } else if (option == 6) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { methods. methods. methods.methodKing();();(); scan++; scan++; scan++; scan++;

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/Finale.java

2.1 of 4 2014.12.03 15:28:22

Page 3: Text adventure

30

scan++; scan++; scan++; scan++; } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number."); } } } } } else if (option == 7) { } else if (option == 7) { } else if (option == 7) { } else if (option == 7) { } else if (option == 7) { } else if (option == 7) { } else if (option == 7) { } else if (option == 7) { } else if (option == 7) { } else if (option == 7) { } else if (option == 7) { } else if (option == 7) { } else if (option == 7) { } else if (option == 7) { } else if (option == 7) { } else if (option == 7) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { tryNCatch. tryNCatch. tryNCatch.tryNCatchKing();();(); scan++; scan++; scan++; scan++; } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number."); } } } } } else if (option == 8) { } else if (option == 8) { } else if (option == 8) { } else if (option == 8) { } else if (option == 8) { } else if (option == 8) { } else if (option == 8) { } else if (option == 8) { } else if (option == 8) { } else if (option == 8) { } else if (option == 8) { } else if (option == 8) { } else if (option == 8) { } else if (option == 8) { } else if (option == 8) { } else if (option == 8) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { classes. classes. classes.classesKing();();(); scan++; scan++; scan++; scan++; } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number.");.println("Please enter a number."); } } } } } else if (option == 9) { } else if (option == 9) { } else if (option == 9) { } else if (option == 9) { } else if (option == 9) { } else if (option == 9) { } else if (option == 9) { } else if (option == 9) { } else if (option == 9) { } else if (option == 9) { } else if (option == 9) { } else if (option == 9) { } else if (option == 9) { } else if (option == 9) { } else if (option == 9) { } else if (option == 9) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { arrays. arrays. arrays.arraysKing();();(); scan++; scan++; scan++; scan++; } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number"); } } } } } else if (option == 10) { } else if (option == 10) { } else if (option == 10) { } else if (option == 10) { } else if (option == 10) { } else if (option == 10) { } else if (option == 10) { } else if (option == 10) { } else if (option == 10) { } else if (option == 10) { } else if (option == 10) { } else if (option == 10) { } else if (option == 10) { } else if (option == 10) { } else if (option == 10) { } else if (option == 10) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { inheritance. inheritance. inheritance.interitanceKing();();(); scan++; scan++; scan++; scan++; } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number"); } } } } } else if (option == 11) { } else if (option == 11) { } else if (option == 11) { } else if (option == 11) { } else if (option == 11) { } else if (option == 11) { } else if (option == 11) { } else if (option == 11) { } else if (option == 11) { } else if (option == 11) { } else if (option == 11) { } else if (option == 11) { } else if (option == 11) { } else if (option == 11) { } else if (option == 11) { } else if (option == 11) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { collections. collections. collections.collectionsKing();();(); scan++; scan++; scan++; scan++; } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number"); } } } } } else if (option == 12) { } else if (option == 12) { } else if (option == 12) { } else if (option == 12) { } else if (option == 12) { } else if (option == 12) { } else if (option == 12) { } else if (option == 12) { } else if (option == 12) { } else if (option == 12) { } else if (option == 12) { } else if (option == 12) { } else if (option == 12) { } else if (option == 12) { } else if (option == 12) { } else if (option == 12) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { strings. strings. strings.stringsKing();();(); scan++; scan++; scan++; scan++; } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number"); } } } } } else if (option == 13) { } else if (option == 13) { } else if (option == 13) { } else if (option == 13) { } else if (option == 13) { } else if (option == 13) { } else if (option == 13) { } else if (option == 13) { } else if (option == 13) { } else if (option == 13) { } else if (option == 13) { } else if (option == 13) { } else if (option == 13) { } else if (option == 13) { } else if (option == 13) { } else if (option == 13) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { misc. misc. misc.miscKing();();(); scan++; scan++; scan++; scan++; } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number"); } } } } // to kill the loop, this is the only way to end the program // to kill the loop, this is the only way to end the program } else if (option == 15) { } else if (option == 15) { } else if (option == 15) { } else if (option == 15) { } else if (option == 15) { } else if (option == 15) { } else if (option == 15) { } else if (option == 15) { } else if (option == 15) { } else if (option == 15) { } else if (option == 15) { } else if (option == 15) { } else if (option == 15) { } else if (option == 15) { } else if (option == 15) { } else if (option == 15) { System. System. System.out.println("You decide you've had enough traveling".println("You decide you've had enough traveling".println("You decide you've had enough traveling".println("You decide you've had enough traveling".println("You decide you've had enough traveling".println("You decide you've had enough traveling" + " for one day, you return home to go to bed."); + " for one day, you return home to go to bed."); + " for one day, you return home to go to bed."); + " for one day, you return home to go to bed."); + " for one day, you return home to go to bed."); + " for one day, you return home to go to bed."); + " for one day, you return home to go to bed."); + " for one day, you return home to go to bed."); loopkill = 1; loopkill = 1; loopkill = 1; loopkill = 1; loopkill = 1; loopkill = 1; loopkill = 1;

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/Finale.java

3.1 of 4 2014.12.03 15:28:22

Page 4: Text adventure

30

loopkill = 1; loopkill = 1; loopkill = 1; loopkill = 1; loopkill = 1; loopkill = 1; loopkill = 1;

} else { } else { } else { } else { } else { } else { System. System. System.out.println("Invalid entry, please try again.");.println("Invalid entry, please try again.");.println("Invalid entry, please try again.");.println("Invalid entry, please try again.");.println("Invalid entry, please try again.");.println("Invalid entry, please try again.");.println("Invalid entry, please try again.");.println("Invalid entry, please try again."); } } } }

} }}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/Finale.java

4.1 of 4 2014.12.03 15:28:22

Page 5: Text adventure

123456789101112131415

1718192021222324252627282930313233343536

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class addingFiveIntegers { {

public static void public static void public static void public static void public static void public static void public static void addingFiveIntegersKing() {() {() {() { int total = 0; // stores the sum of the 5 numbers int total = 0; // stores the sum of the 5 numbers int total = 0; // stores the sum of the 5 numbers int total = 0; // stores the sum of the 5 numbers int total = 0; // stores the sum of the 5 numbers int total = 0; // stores the sum of the 5 numbers int total = 0; // stores the sum of the 5 numbers int total = 0; // stores the sum of the 5 numbers int total = 0; // stores the sum of the 5 numbers int total = 0; // stores the sum of the 5 numbers int total = 0; // stores the sum of the 5 numbers int total = 0; // stores the sum of the 5 numbers int number; // stores the current input int number; // stores the current input int number; // stores the current input int number; // stores the current input int number; // stores the current input int number; // stores the current input int number; // stores the current input int number; // stores the current input Scanner scan = new Scanner(System. Scanner scan = new Scanner(System. Scanner scan = new Scanner(System. Scanner scan = new Scanner(System. Scanner scan = new Scanner(System. Scanner scan = new Scanner(System. Scanner scan = new Scanner(System. Scanner scan = new Scanner(System. Scanner scan = new Scanner(System. Scanner scan = new Scanner(System. Scanner scan = new Scanner(System. Scanner scan = new Scanner(System. Scanner scan = new Scanner(System.in);); int a = 1; // limits loop to 5 int a = 1; // limits loop to 5 int a = 1; // limits loop to 5 int a = 1; // limits loop to 5 int a = 1; // limits loop to 5 int a = 1; // limits loop to 5 int a = 1; // limits loop to 5 int a = 1; // limits loop to 5 int a = 1; // limits loop to 5 int a = 1; // limits loop to 5 int a = 1; // limits loop to 5

while (a <= 5) {// limits loop to 5 while (a <= 5) {// limits loop to 5 while (a <= 5) {// limits loop to 5 while (a <= 5) {// limits loop to 5 while (a <= 5) {// limits loop to 5 while (a <= 5) {// limits loop to 5 while (a <= 5) {// limits loop to 5 while (a <= 5) {// limits loop to 5 while (a <= 5) {// limits loop to 5 while (a <= 5) {// limits loop to 5 while (a <= 5) {// limits loop to 5 while (a <= 5) {// limits loop to 5 while (a <= 5) {// limits loop to 5 System. System. System.out.print("Say a number please ");.print("Say a number please ");.print("Say a number please ");.print("Say a number please ");.print("Say a number please ");.print("Say a number please ");.print("Say a number please ");.print("Say a number please "); number = scan.nextInt(); number = scan.nextInt(); number = scan.nextInt(); number = scan.nextInt(); number = scan.nextInt(); number = scan.nextInt(); number = scan.nextInt(); number = scan.nextInt(); number = scan.nextInt(); number = scan.nextInt(); number = scan.nextInt(); total = total + number; total = total + number; total = total + number; total = total + number; total = total + number; total = total + number; total = total + number; total = total + number; total = total + number; total = total + number; total = total + number; a++; // This only exists to limit the loop to 5 a++; // This only exists to limit the loop to 5 a++; // This only exists to limit the loop to 5 a++; // This only exists to limit the loop to 5 a++; // This only exists to limit the loop to 5 a++; // This only exists to limit the loop to 5

} }

System. System. System.out.println("The total is: " + total);.println("The total is: " + total);.println("The total is: " + total);.println("The total is: " + total);.println("The total is: " + total);.println("The total is: " + total);.println("The total is: " + total);.println("The total is: " + total);.println("The total is: " + total);.println("The total is: " + total);.println("The total is: " + total);.println("The total is: " + total); } }

}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/addingFiveIntegers.java

1.1 of 1 2014.12.03 15:00:24

Page 6: Text adventure

123456789101112131415161718192021222324252627282930313233343536373839

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class areaOfCircle { {

// Constant PI is defined at the class level // Constant PI is defined at the class level // Constant PI is defined at the class level static final double static final double static final double static final double static final double static final double static final double PI = Math. = Math. = Math. = Math. = Math.PI; public static double public static double public static double public static double public static double public static double public static double radius, , area;

void void void getArea() {() {() {() { // Method used to calculate area of a circle // Method used to calculate area of a circle // Method used to calculate area of a circle final Scanner sc = new Scanner(System. final Scanner sc = new Scanner(System. final Scanner sc = new Scanner(System. final Scanner sc = new Scanner(System. final Scanner sc = new Scanner(System. final Scanner sc = new Scanner(System. final Scanner sc = new Scanner(System. final Scanner sc = new Scanner(System. final Scanner sc = new Scanner(System. final Scanner sc = new Scanner(System. final Scanner sc = new Scanner(System. final Scanner sc = new Scanner(System. final Scanner sc = new Scanner(System. final Scanner sc = new Scanner(System. final Scanner sc = new Scanner(System.in);); System. System. System.out.println("Assassin: 'Give him a radius, make him calculate ".println("Assassin: 'Give him a radius, make him calculate ".println("Assassin: 'Give him a radius, make him calculate ".println("Assassin: 'Give him a radius, make him calculate ".println("Assassin: 'Give him a radius, make him calculate ".println("Assassin: 'Give him a radius, make him calculate " + "the area of the circle in his head'"); + "the area of the circle in his head'"); + "the area of the circle in his head'"); + "the area of the circle in his head'"); + "the area of the circle in his head'"); + "the area of the circle in his head'"); + "the area of the circle in his head'"); + "the area of the circle in his head'"); radius = sc.nextDouble(); = sc.nextDouble(); = sc.nextDouble(); = sc.nextDouble(); = sc.nextDouble(); = sc.nextDouble(); = sc.nextDouble(); = sc.nextDouble(); = sc.nextDouble(); area = = = PI * * * radius * * * radius; // equation of area of circle; // equation of area of circle; // equation of area of circle System. System. System.out.println("Man: The area of circle is: " + .println("Man: The area of circle is: " + .println("Man: The area of circle is: " + .println("Man: The area of circle is: " + .println("Man: The area of circle is: " + .println("Man: The area of circle is: " + .println("Man: The area of circle is: " + .println("Man: The area of circle is: " + .println("Man: The area of circle is: " + area););

} }

public static void public static void public static void public static void public static void public static void public static void areaOfCircleKing() {() {() {() { areaOfCircle c1 = new areaOfCircle();//calls the calculations areaOfCircle c1 = new areaOfCircle();//calls the calculations areaOfCircle c1 = new areaOfCircle();//calls the calculations areaOfCircle c1 = new areaOfCircle();//calls the calculations areaOfCircle c1 = new areaOfCircle();//calls the calculations areaOfCircle c1 = new areaOfCircle();//calls the calculations areaOfCircle c1 = new areaOfCircle();//calls the calculations areaOfCircle c1 = new areaOfCircle();//calls the calculations areaOfCircle c1 = new areaOfCircle();//calls the calculations areaOfCircle c1 = new areaOfCircle();//calls the calculations areaOfCircle c1 = new areaOfCircle();//calls the calculations areaOfCircle c1 = new areaOfCircle();//calls the calculations areaOfCircle c1 = new areaOfCircle();//calls the calculations areaOfCircle c1 = new areaOfCircle();//calls the calculations c1.getArea(); c1.getArea(); c1.getArea(); c1.getArea(); c1.getArea(); c1.getArea(); c1.getArea();

} }}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/areaOfCircle.java

1.1 of 1 2014.12.03 14:53:14

Page 7: Text adventure

1234567891011121314151617181920212223242526272829303132

3435363738394041424344454647

Page 8: Text adventure

737475767778798081828384

}; }; };

circle1.setradius(radius); circle1.setradius(radius); circle1.setradius(radius); circle1.setradius(radius); circle1.setradius(radius); circle1.setradius(radius); circle1.setradius(radius); circle1.setradius(radius); circle1.toString(); circle1.toString(); circle1.toString(); circle1.toString(); circle1.toString(); circle1.toString(); circle1.toString();

return "Radius " + radius + " and Area is " + area; return "Radius " + radius + " and Area is " + area; return "Radius " + radius + " and Area is " + area; return "Radius " + radius + " and Area is " + area; return "Radius " + radius + " and Area is " + area; return "Radius " + radius + " and Area is " + area; return "Radius " + radius + " and Area is " + area; return "Radius " + radius + " and Area is " + area; return "Radius " + radius + " and Area is " + area; return "Radius " + radius + " and Area is " + area; return "Radius " + radius + " and Area is " + area; return "Radius " + radius + " and Area is " + area; return "Radius " + radius + " and Area is " + area; return "Radius " + radius + " and Area is " + area; return "Radius " + radius + " and Area is " + area; return "Radius " + radius + " and Area is " + area; return "Radius " + radius + " and Area is " + area; return "Radius " + radius + " and Area is " + area; return "Radius " + radius + " and Area is " + area; return "Radius " + radius + " and Area is " + area; return "Radius " + radius + " and Area is " + area;

} } } }

}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/areaOfCircleAgain.java

2.1 of 2 2014.12.03 14:43:10

Page 9: Text adventure

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class arithmatic { {

public static void public static void public static void public static void public static void public static void public static void arithmaticKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in); ); );

int problem = 0; int problem = 0; int problem = 0; int problem = 0; int problem = 0; int problem = 0; int problem = 0; int problem = 0; int problem = 0; int scan = 0; int scan = 0; int scan = 0; int scan = 0; int scan = 0; int scan = 0; int scan = 0; int scan = 0; int scan = 0;

System. System. System.out.println("You enter the greak kingdome of arthimos, which jus".println("You enter the greak kingdome of arthimos, which jus".println("You enter the greak kingdome of arthimos, which jus".println("You enter the greak kingdome of arthimos, which jus".println("You enter the greak kingdome of arthimos, which jus".println("You enter the greak kingdome of arthimos, which jus" + "t turns out to be a pillow fort."); + "t turns out to be a pillow fort."); + "t turns out to be a pillow fort."); + "t turns out to be a pillow fort."); + "t turns out to be a pillow fort."); + "t turns out to be a pillow fort."); + "t turns out to be a pillow fort."); + "t turns out to be a pillow fort."); System. System. System.out.println("The 10 year old king adresses you");.println("The 10 year old king adresses you");.println("The 10 year old king adresses you");.println("The 10 year old king adresses you");.println("The 10 year old king adresses you");.println("The 10 year old king adresses you");.println("The 10 year old king adresses you");.println("The 10 year old king adresses you"); System. System. System.out.println("King: 'Hello loyal subject, I am having trouble wit".println("King: 'Hello loyal subject, I am having trouble wit".println("King: 'Hello loyal subject, I am having trouble wit".println("King: 'Hello loyal subject, I am having trouble wit".println("King: 'Hello loyal subject, I am having trouble wit".println("King: 'Hello loyal subject, I am having trouble wit" + "h the homewrok issued by the dreadded"); + "h the homewrok issued by the dreadded"); + "h the homewrok issued by the dreadded"); + "h the homewrok issued by the dreadded"); + "h the homewrok issued by the dreadded"); + "h the homewrok issued by the dreadded"); + "h the homewrok issued by the dreadded"); + "h the homewrok issued by the dreadded"); System. System. System.out.println("Ms. Burns. I command your help'");.println("Ms. Burns. I command your help'");.println("Ms. Burns. I command your help'");.println("Ms. Burns. I command your help'");.println("Ms. Burns. I command your help'");.println("Ms. Burns. I command your help'");.println("Ms. Burns. I command your help'");.println("Ms. Burns. I command your help'"); System. System. System.out.println("He hands you a piece of paper with problems on it. ".println("He hands you a piece of paper with problems on it. ".println("He hands you a piece of paper with problems on it. ".println("He hands you a piece of paper with problems on it. ".println("He hands you a piece of paper with problems on it. ".println("He hands you a piece of paper with problems on it. " + "You look at him confused."); + "You look at him confused."); + "You look at him confused."); + "You look at him confused."); + "You look at him confused."); + "You look at him confused."); + "You look at him confused."); + "You look at him confused."); System. System. System.out.println("King: 'We are not allowed to cheat so I ask you to ".println("King: 'We are not allowed to cheat so I ask you to ".println("King: 'We are not allowed to cheat so I ask you to ".println("King: 'We are not allowed to cheat so I ask you to ".println("King: 'We are not allowed to cheat so I ask you to ".println("King: 'We are not allowed to cheat so I ask you to " + "provide me with examples and solutions'"); + "provide me with examples and solutions'"); + "provide me with examples and solutions'"); + "provide me with examples and solutions'"); + "provide me with examples and solutions'"); + "provide me with examples and solutions'"); + "provide me with examples and solutions'"); + "provide me with examples and solutions'"); while (problem != 4) { while (problem != 4) { while (problem != 4) { while (problem != 4) { while (problem != 4) { while (problem != 4) { while (problem != 4) { while (problem != 4) { while (problem != 4) { while (problem != 4) { while (problem != 4) { while (problem != 4) { scan = 0; scan = 0; scan = 0; scan = 0; scan = 0; scan = 0; scan = 0; System. System. System.out.println("Which type of problem do you wish to help him w".println("Which type of problem do you wish to help him w".println("Which type of problem do you wish to help him w".println("Which type of problem do you wish to help him w".println("Which type of problem do you wish to help him w".println("Which type of problem do you wish to help him w" + "ith?"); + "ith?"); + "ith?"); + "ith?"); + "ith?"); + "ith?"); + "ith?"); + "ith?"); System. System. System.out.println("1: absolute value, 2:rounding up and down, 3: q".println("1: absolute value, 2:rounding up and down, 3: q".println("1: absolute value, 2:rounding up and down, 3: q".println("1: absolute value, 2:rounding up and down, 3: q".println("1: absolute value, 2:rounding up and down, 3: q".println("1: absolute value, 2:rounding up and down, 3: q" + "uadratic root or 4: leave?"); + "uadratic root or 4: leave?"); + "uadratic root or 4: leave?"); + "uadratic root or 4: leave?"); + "uadratic root or 4: leave?"); + "uadratic root or 4: leave?"); + "uadratic root or 4: leave?"); + "uadratic root or 4: leave?"); problem = in.nextInt(); problem = in.nextInt(); problem = in.nextInt(); problem = in.nextInt(); problem = in.nextInt(); problem = in.nextInt(); problem = in.nextInt(); problem = in.nextInt(); problem = in.nextInt(); problem = in.nextInt(); problem = in.nextInt(); switch (problem) { switch (problem) { switch (problem) { switch (problem) { switch (problem) { switch (problem) { switch (problem) { switch (problem) { case 1: case 1: case 1: case 1: case 1: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { absValue. absValue. absValue.absValueKing();();(); System. System. System.out.println("The young king thanks you and y".println("The young king thanks you and y".println("The young king thanks you and y".println("The young king thanks you and y".println("The young king thanks you and y".println("The young king thanks you and y" + "ou leave Arithmos the greatest pillow f" + "ou leave Arithmos the greatest pillow f" + "ou leave Arithmos the greatest pillow f" + "ou leave Arithmos the greatest pillow f" + "ou leave Arithmos the greatest pillow f" + "ou leave Arithmos the greatest pillow f" + "ort the worlds ever seen."); + "ort the worlds ever seen."); + "ort the worlds ever seen."); + "ort the worlds ever seen."); + "ort the worlds ever seen."); + "ort the worlds ever seen."); + "ort the worlds ever seen."); + "ort the worlds ever seen."); scan++; // ends loop scan++; // ends loop scan++; // ends loop scan++; // ends loop scan++; // ends loop scan++; // ends loop } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number"); } } } } break; break; break; case 2: case 2: case 2: case 2: case 2: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { upOrDown. upOrDown. upOrDown.upOrDownKing();();(); System. System. System.out.println("The young king thanks you and y".println("The young king thanks you and y".println("The young king thanks you and y".println("The young king thanks you and y".println("The young king thanks you and y".println("The young king thanks you and y" + "ou leave Arithmos the greatest pillow fo" + "ou leave Arithmos the greatest pillow fo" + "ou leave Arithmos the greatest pillow fo" + "ou leave Arithmos the greatest pillow fo" + "ou leave Arithmos the greatest pillow fo" + "ou leave Arithmos the greatest pillow fo" + "rt the worlds ever seen."); + "rt the worlds ever seen."); + "rt the worlds ever seen."); + "rt the worlds ever seen."); + "rt the worlds ever seen."); + "rt the worlds ever seen."); + "rt the worlds ever seen."); + "rt the worlds ever seen."); scan++; // ends loop scan++; // ends loop scan++; // ends loop scan++; // ends loop scan++; // ends loop scan++; // ends loop } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number"); } } } } break; break; break; case 3: case 3: case 3: case 3: case 3: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { quadRoot. quadRoot. quadRoot.quadRootKing();();(); System. System. System.out.println("The young king thanks you and y".println("The young king thanks you and y".println("The young king thanks you and y".println("The young king thanks you and y".println("The young king thanks you and y".println("The young king thanks you and y" + "ou leave Arithmos the greatest pillow fo" + "ou leave Arithmos the greatest pillow fo" + "ou leave Arithmos the greatest pillow fo" + "ou leave Arithmos the greatest pillow fo" + "ou leave Arithmos the greatest pillow fo" + "ou leave Arithmos the greatest pillow fo"

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/arithmatic.java

1.1 of 2 2014.12.03 15:14:50

Page 10: Text adventure

73747576777879808182838485

+ "ou leave Arithmos the greatest pillow fo" + "ou leave Arithmos the greatest pillow fo" + "ou leave Arithmos the greatest pillow fo" + "ou leave Arithmos the greatest pillow fo" + "ou leave Arithmos the greatest pillow fo" + "ou leave Arithmos the greatest pillow fo" + "rt the worlds ever seen."); + "rt the worlds ever seen."); + "rt the worlds ever seen."); + "rt the worlds ever seen."); + "rt the worlds ever seen."); + "rt the worlds ever seen."); + "rt the worlds ever seen."); + "rt the worlds ever seen."); scan++; // ends loop scan++; // ends loop scan++; // ends loop scan++; // ends loop scan++; // ends loop scan++; // ends loop } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number"); } } } } break; break; break; } } } } } }}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/arithmatic.java

2.1 of 2 2014.12.03 15:14:50

Page 11: Text adventure

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner; import java.util.Scanner; import java.util.Scanner; import java.util.Scanner; import java.util.Scanner; import java.util.Scanner; import java.util.Scanner; import java.util.Scanner; import java.util.Scanner;

public class public class public class public class arithmeticOperations { {

public static void public static void public static void public static void public static void public static void public static void arithmeticOperationsKing() {() {() {() {

int a, b; int a, b; int a, b; int a, b; int a, b; int a, b; int a, b; int a, b; int resulta, results, resultm; int resulta, results, resultm; int resulta, results, resultm; int resulta, results, resultm; int resulta, results, resultm; int resulta, results, resultm; int resulta, results, resultm; int resulta, results, resultm; int resulta, results, resultm; int resulta, results, resultm; int resulta, results, resultm; double resultd; double resultd; double resultd; double resultd; double resultd; Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in); ); ); System. System. System.out.println("How many times do you wish to bark the first ".println("How many times do you wish to bark the first ".println("How many times do you wish to bark the first ".println("How many times do you wish to bark the first ".println("How many times do you wish to bark the first ".println("How many times do you wish to bark the first " + "time?"); + "time?"); + "time?"); + "time?"); + "time?"); + "time?"); + "time?"); + "time?"); a = in.nextInt(); a = in.nextInt(); a = in.nextInt(); a = in.nextInt(); a = in.nextInt(); a = in.nextInt(); a = in.nextInt(); a = in.nextInt(); a = in.nextInt(); a = in.nextInt(); a = in.nextInt(); System. System. System.out.println("How many times do you wish to bark the second ".println("How many times do you wish to bark the second ".println("How many times do you wish to bark the second ".println("How many times do you wish to bark the second ".println("How many times do you wish to bark the second ".println("How many times do you wish to bark the second " + "time?"); + "time?"); + "time?"); + "time?"); + "time?"); + "time?"); + "time?"); + "time?"); b = in.nextInt(); b = in.nextInt(); b = in.nextInt(); b = in.nextInt(); b = in.nextInt(); b = in.nextInt(); b = in.nextInt(); b = in.nextInt(); b = in.nextInt(); b = in.nextInt(); b = in.nextInt(); resulta = a + b; // addition resulta = a + b; // addition resulta = a + b; // addition resulta = a + b; // addition resulta = a + b; // addition resulta = a + b; // addition resulta = a + b; // addition resulta = a + b; // addition resulta = a + b; // addition resulta = a + b; // addition resulta = a + b; // addition resulta = a + b; // addition resulta = a + b; // addition results = a - b; // subtraction results = a - b; // subtraction results = a - b; // subtraction results = a - b; // subtraction results = a - b; // subtraction results = a - b; // subtraction results = a - b; // subtraction results = a - b; // subtraction results = a - b; // subtraction results = a - b; // subtraction results = a - b; // subtraction results = a - b; // subtraction results = a - b; // subtraction resultm = a * b; // multiplication resultm = a * b; // multiplication resultm = a * b; // multiplication resultm = a * b; // multiplication resultm = a * b; // multiplication resultm = a * b; // multiplication resultm = a * b; // multiplication resultm = a * b; // multiplication resultm = a * b; // multiplication resultm = a * b; // multiplication resultm = a * b; // multiplication resultm = a * b; // multiplication resultm = a * b; // multiplication resultd = (double) a / b; //division resultd = (double) a / b; //division resultd = (double) a / b; //division resultd = (double) a / b; //division resultd = (double) a / b; //division resultd = (double) a / b; //division resultd = (double) a / b; //division resultd = (double) a / b; //division resultd = (double) a / b; //division resultd = (double) a / b; //division resultd = (double) a / b; //division resultd = (double) a / b; //division resultd = (double) a / b; //division resultd = (double) a / b; //division resultd = (double) a / b; //division resultd = (double) a / b; //division resultd = (double) a / b; //division resultd = (double) a / b; //division

System. System. System.out.print("The dog barks back " + resulta);.print("The dog barks back " + resulta);.print("The dog barks back " + resulta);.print("The dog barks back " + resulta);.print("The dog barks back " + resulta);.print("The dog barks back " + resulta);.print("The dog barks back " + resulta);.print("The dog barks back " + resulta);.print("The dog barks back " + resulta);.print("The dog barks back " + resulta);.print("The dog barks back " + resulta);.print("The dog barks back " + resulta); System. System. System.out.println(" times, this is clearly the result of addition");.println(" times, this is clearly the result of addition");.println(" times, this is clearly the result of addition");.println(" times, this is clearly the result of addition");.println(" times, this is clearly the result of addition");.println(" times, this is clearly the result of addition");.println(" times, this is clearly the result of addition");.println(" times, this is clearly the result of addition"); System. System. System.out.print("The dog barks back " + results);.print("The dog barks back " + results);.print("The dog barks back " + results);.print("The dog barks back " + results);.print("The dog barks back " + results);.print("The dog barks back " + results);.print("The dog barks back " + results);.print("The dog barks back " + results);.print("The dog barks back " + results);.print("The dog barks back " + results);.print("The dog barks back " + results);.print("The dog barks back " + results); System. System. System.out.println(" times, this is clearly the result of subtraction");.println(" times, this is clearly the result of subtraction");.println(" times, this is clearly the result of subtraction");.println(" times, this is clearly the result of subtraction");.println(" times, this is clearly the result of subtraction");.println(" times, this is clearly the result of subtraction");.println(" times, this is clearly the result of subtraction");.println(" times, this is clearly the result of subtraction"); System. System. System.out.print("The dog barks back " + resultm);.print("The dog barks back " + resultm);.print("The dog barks back " + resultm);.print("The dog barks back " + resultm);.print("The dog barks back " + resultm);.print("The dog barks back " + resultm);.print("The dog barks back " + resultm);.print("The dog barks back " + resultm);.print("The dog barks back " + resultm);.print("The dog barks back " + resultm);.print("The dog barks back " + resultm);.print("The dog barks back " + resultm); System. System. System.out.println(" times, this is clearly the result of ".println(" times, this is clearly the result of ".println(" times, this is clearly the result of ".println(" times, this is clearly the result of ".println(" times, this is clearly the result of ".println(" times, this is clearly the result of " + "multiplication"); + "multiplication"); + "multiplication"); + "multiplication"); + "multiplication"); + "multiplication"); + "multiplication"); + "multiplication"); System. System. System.out.print("The dog barks back " + resultd);.print("The dog barks back " + resultd);.print("The dog barks back " + resultd);.print("The dog barks back " + resultd);.print("The dog barks back " + resultd);.print("The dog barks back " + resultd);.print("The dog barks back " + resultd);.print("The dog barks back " + resultd);.print("The dog barks back " + resultd);.print("The dog barks back " + resultd);.print("The dog barks back " + resultd);.print("The dog barks back " + resultd); System. System. System.out.println(" times, this is clearly the result of subtraction");.println(" times, this is clearly the result of subtraction");.println(" times, this is clearly the result of subtraction");.println(" times, this is clearly the result of subtraction");.println(" times, this is clearly the result of subtraction");.println(" times, this is clearly the result of subtraction");.println(" times, this is clearly the result of subtraction");.println(" times, this is clearly the result of subtraction");

} }}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/arithmeticOperations.java

1.1 of 1 2014.12.03 15:20:17

Page 12: Text adventure

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class arithmeticOperations2 { {

public static void public static void public static void public static void public static void public static void public static void arithmeticOperations2King() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in); // in because patterns); // in because patterns); // in because patterns); // in because patterns int sum, diff, product, quotient; //much more compact. int sum, diff, product, quotient; //much more compact. int sum, diff, product, quotient; //much more compact. int sum, diff, product, quotient; //much more compact. int sum, diff, product, quotient; //much more compact. int sum, diff, product, quotient; //much more compact. int sum, diff, product, quotient; //much more compact. int sum, diff, product, quotient; //much more compact. int sum, diff, product, quotient; //much more compact. int sum, diff, product, quotient; //much more compact. int sum, diff, product, quotient; //much more compact. int sum, diff, product, quotient; //much more compact. int sum, diff, product, quotient; //much more compact. int sum, diff, product, quotient; //much more compact. int sum, diff, product, quotient; //much more compact. int sum, diff, product, quotient; //much more compact. System. System. System.out.println("How mnay times would you like to jump the first ".println("How mnay times would you like to jump the first ".println("How mnay times would you like to jump the first ".println("How mnay times would you like to jump the first ".println("How mnay times would you like to jump the first ".println("How mnay times would you like to jump the first " + "time?"); + "time?"); + "time?"); + "time?"); + "time?"); + "time?"); + "time?"); + "time?"); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); System. System. System.out.println("How many times would you like to jump the second ".println("How many times would you like to jump the second ".println("How many times would you like to jump the second ".println("How many times would you like to jump the second ".println("How many times would you like to jump the second ".println("How many times would you like to jump the second " + "time?"); + "time?"); + "time?"); + "time?"); + "time?"); + "time?"); + "time?"); + "time?"); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt();

sum = num1 + num2; sum = num1 + num2; sum = num1 + num2; sum = num1 + num2; sum = num1 + num2; sum = num1 + num2; sum = num1 + num2; sum = num1 + num2; sum = num1 + num2; sum = num1 + num2; sum = num1 + num2; diff = num1 - num2; diff = num1 - num2; diff = num1 - num2; diff = num1 - num2; diff = num1 - num2; diff = num1 - num2; diff = num1 - num2; diff = num1 - num2; diff = num1 - num2; diff = num1 - num2; diff = num1 - num2; product = num1 * num2; product = num1 * num2; product = num1 * num2; product = num1 * num2; product = num1 * num2; product = num1 * num2; product = num1 * num2; product = num1 * num2; product = num1 * num2; product = num1 * num2; product = num1 * num2; quotient = num1 / num2; quotient = num1 / num2; quotient = num1 / num2; quotient = num1 / num2; quotient = num1 / num2; quotient = num1 / num2; quotient = num1 / num2; quotient = num1 / num2; quotient = num1 / num2; quotient = num1 / num2; quotient = num1 / num2;

System. System. System.out.print("The ball bounces " + sum);.print("The ball bounces " + sum);.print("The ball bounces " + sum);.print("The ball bounces " + sum);.print("The ball bounces " + sum);.print("The ball bounces " + sum);.print("The ball bounces " + sum);.print("The ball bounces " + sum);.print("The ball bounces " + sum);.print("The ball bounces " + sum);.print("The ball bounces " + sum);.print("The ball bounces " + sum); System. System. System.out.println(" times, this is clearly the result of addition");.println(" times, this is clearly the result of addition");.println(" times, this is clearly the result of addition");.println(" times, this is clearly the result of addition");.println(" times, this is clearly the result of addition");.println(" times, this is clearly the result of addition");.println(" times, this is clearly the result of addition");.println(" times, this is clearly the result of addition"); System. System. System.out.print("the ball bounces " + diff);.print("the ball bounces " + diff);.print("the ball bounces " + diff);.print("the ball bounces " + diff);.print("the ball bounces " + diff);.print("the ball bounces " + diff);.print("the ball bounces " + diff);.print("the ball bounces " + diff);.print("the ball bounces " + diff);.print("the ball bounces " + diff);.print("the ball bounces " + diff);.print("the ball bounces " + diff); System. System. System.out.println(" times, this is clearly the result of subtraction");.println(" times, this is clearly the result of subtraction");.println(" times, this is clearly the result of subtraction");.println(" times, this is clearly the result of subtraction");.println(" times, this is clearly the result of subtraction");.println(" times, this is clearly the result of subtraction");.println(" times, this is clearly the result of subtraction");.println(" times, this is clearly the result of subtraction"); System. System. System.out.print("The ball bounces " + product);.print("The ball bounces " + product);.print("The ball bounces " + product);.print("The ball bounces " + product);.print("The ball bounces " + product);.print("The ball bounces " + product);.print("The ball bounces " + product);.print("The ball bounces " + product);.print("The ball bounces " + product);.print("The ball bounces " + product);.print("The ball bounces " + product);.print("The ball bounces " + product); System. System. System.out.println(" times, this clearly is the result of subtraction");.println(" times, this clearly is the result of subtraction");.println(" times, this clearly is the result of subtraction");.println(" times, this clearly is the result of subtraction");.println(" times, this clearly is the result of subtraction");.println(" times, this clearly is the result of subtraction");.println(" times, this clearly is the result of subtraction");.println(" times, this clearly is the result of subtraction"); System. System. System.out.print("The ball sits quietly and then freaks out bouncing ".print("The ball sits quietly and then freaks out bouncing ".print("The ball sits quietly and then freaks out bouncing ".print("The ball sits quietly and then freaks out bouncing ".print("The ball sits quietly and then freaks out bouncing ".print("The ball sits quietly and then freaks out bouncing " + "off the walls " + quotient); + "off the walls " + quotient); + "off the walls " + quotient); + "off the walls " + quotient); + "off the walls " + quotient); + "off the walls " + quotient); + "off the walls " + quotient); + "off the walls " + quotient); + "off the walls " + quotient); + "off the walls " + quotient); + "off the walls " + quotient); + "off the walls " + quotient); System. System. System.out.println(" times ending with smacking you in the head.");.println(" times ending with smacking you in the head.");.println(" times ending with smacking you in the head.");.println(" times ending with smacking you in the head.");.println(" times ending with smacking you in the head.");.println(" times ending with smacking you in the head.");.println(" times ending with smacking you in the head.");.println(" times ending with smacking you in the head."); System. System. System.out.println("The ball clearly doesnt like the number ".println("The ball clearly doesnt like the number ".println("The ball clearly doesnt like the number ".println("The ball clearly doesnt like the number ".println("The ball clearly doesnt like the number ".println("The ball clearly doesnt like the number " + quotient); + quotient); + quotient); + quotient); + quotient); + quotient);

} }

}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/arithmeticOperations2.java

1.1 of 1 2014.12.03 15:20:18

Page 13: Text adventure

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class arrays { {

public static void public static void public static void public static void public static void public static void public static void arraysKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in); ); ); int arraychoice = 0, scan; int arraychoice = 0, scan; int arraychoice = 0, scan; int arraychoice = 0, scan; int arraychoice = 0, scan; int arraychoice = 0, scan; int arraychoice = 0, scan; int arraychoice = 0, scan; int arraychoice = 0, scan; int arraychoice = 0, scan; int arraychoice = 0, scan; int arraychoice = 0, scan; System. System. System.out.println("You walk up to the pirate ship and see a pirate".println("You walk up to the pirate ship and see a pirate".println("You walk up to the pirate ship and see a pirate".println("You walk up to the pirate ship and see a pirate".println("You walk up to the pirate ship and see a pirate".println("You walk up to the pirate ship and see a pirate" + "."); + "."); + "."); + "."); + "."); + "."); + "."); + "."); System. System. System.out.println("Pirate: 'Arr ye matey! If ye with entry thy must wa".println("Pirate: 'Arr ye matey! If ye with entry thy must wa".println("Pirate: 'Arr ye matey! If ye with entry thy must wa".println("Pirate: 'Arr ye matey! If ye with entry thy must wa".println("Pirate: 'Arr ye matey! If ye with entry thy must wa".println("Pirate: 'Arr ye matey! If ye with entry thy must wa" + "lk the plank!'"); + "lk the plank!'"); + "lk the plank!'"); + "lk the plank!'"); + "lk the plank!'"); + "lk the plank!'"); + "lk the plank!'"); + "lk the plank!'"); System. System. System.out.println("You get cautious but then you see that the entrance".println("You get cautious but then you see that the entrance".println("You get cautious but then you see that the entrance".println("You get cautious but then you see that the entrance".println("You get cautious but then you see that the entrance".println("You get cautious but then you see that the entrance" + "to the pirate ship is just a plank of wood. You cross it."); + "to the pirate ship is just a plank of wood. You cross it."); + "to the pirate ship is just a plank of wood. You cross it."); + "to the pirate ship is just a plank of wood. You cross it."); + "to the pirate ship is just a plank of wood. You cross it."); + "to the pirate ship is just a plank of wood. You cross it."); + "to the pirate ship is just a plank of wood. You cross it."); + "to the pirate ship is just a plank of wood. You cross it."); System. System. System.out.println("Pirate: 'Arr good job laddeh, you passed the first".println("Pirate: 'Arr good job laddeh, you passed the first".println("Pirate: 'Arr good job laddeh, you passed the first".println("Pirate: 'Arr good job laddeh, you passed the first".println("Pirate: 'Arr good job laddeh, you passed the first".println("Pirate: 'Arr good job laddeh, you passed the first" + " test.'"); + " test.'"); + " test.'"); + " test.'"); + " test.'"); + " test.'"); + " test.'"); + " test.'"); System. System. System.out.println("Pirate: 'There be 3 other tests, ye may come and ".println("Pirate: 'There be 3 other tests, ye may come and ".println("Pirate: 'There be 3 other tests, ye may come and ".println("Pirate: 'There be 3 other tests, ye may come and ".println("Pirate: 'There be 3 other tests, ye may come and ".println("Pirate: 'There be 3 other tests, ye may come and " + "go as ye please."); + "go as ye please."); + "go as ye please."); + "go as ye please."); + "go as ye please."); + "go as ye please."); + "go as ye please."); + "go as ye please."); System. System. System.out.println("Pirate: 'Ye can go to the school where we teach th".println("Pirate: 'Ye can go to the school where we teach th".println("Pirate: 'Ye can go to the school where we teach th".println("Pirate: 'Ye can go to the school where we teach th".println("Pirate: 'Ye can go to the school where we teach th".println("Pirate: 'Ye can go to the school where we teach th" + "e youngins.'"); + "e youngins.'"); + "e youngins.'"); + "e youngins.'"); + "e youngins.'"); + "e youngins.'"); + "e youngins.'"); + "e youngins.'"); System. System. System.out.println("Pirae: 'Ye can go to the playin' station where we b".println("Pirae: 'Ye can go to the playin' station where we b".println("Pirae: 'Ye can go to the playin' station where we b".println("Pirae: 'Ye can go to the playin' station where we b".println("Pirae: 'Ye can go to the playin' station where we b".println("Pirae: 'Ye can go to the playin' station where we b" + "e playin' Liar's dice.'"); + "e playin' Liar's dice.'"); + "e playin' Liar's dice.'"); + "e playin' Liar's dice.'"); + "e playin' Liar's dice.'"); + "e playin' Liar's dice.'"); + "e playin' Liar's dice.'"); + "e playin' Liar's dice.'"); System. System. System.out.println("Pirate: Or ye can go and see the fortune teller.");.println("Pirate: Or ye can go and see the fortune teller.");.println("Pirate: Or ye can go and see the fortune teller.");.println("Pirate: Or ye can go and see the fortune teller.");.println("Pirate: Or ye can go and see the fortune teller.");.println("Pirate: Or ye can go and see the fortune teller.");.println("Pirate: Or ye can go and see the fortune teller.");.println("Pirate: Or ye can go and see the fortune teller."); while (arraychoice != 4) { while (arraychoice != 4) { while (arraychoice != 4) { while (arraychoice != 4) { while (arraychoice != 4) { while (arraychoice != 4) { while (arraychoice != 4) { while (arraychoice != 4) { while (arraychoice != 4) { while (arraychoice != 4) { while (arraychoice != 4) { while (arraychoice != 4) { scan = 0; scan = 0; scan = 0; scan = 0; scan = 0; scan = 0; scan = 0; System. System. System.out.println("Where would you like to go?");.println("Where would you like to go?");.println("Where would you like to go?");.println("Where would you like to go?");.println("Where would you like to go?");.println("Where would you like to go?");.println("Where would you like to go?");.println("Where would you like to go?"); System. System. System.out.println("1:The school, 2:The game, 3:The fortune teller,".println("1:The school, 2:The game, 3:The fortune teller,".println("1:The school, 2:The game, 3:The fortune teller,".println("1:The school, 2:The game, 3:The fortune teller,".println("1:The school, 2:The game, 3:The fortune teller,".println("1:The school, 2:The game, 3:The fortune teller," + " or 4:Leave?"); + " or 4:Leave?"); + " or 4:Leave?"); + " or 4:Leave?"); + " or 4:Leave?"); + " or 4:Leave?"); + " or 4:Leave?"); + " or 4:Leave?"); arraychoice = in.nextInt(); arraychoice = in.nextInt(); arraychoice = in.nextInt(); arraychoice = in.nextInt(); arraychoice = in.nextInt(); arraychoice = in.nextInt(); arraychoice = in.nextInt(); arraychoice = in.nextInt(); arraychoice = in.nextInt(); arraychoice = in.nextInt(); arraychoice = in.nextInt(); switch (arraychoice) { switch (arraychoice) { switch (arraychoice) { switch (arraychoice) { switch (arraychoice) { switch (arraychoice) { switch (arraychoice) { switch (arraychoice) { case 1: case 1: case 1: case 1: case 1: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { try { System. System. System.out.println("You walk through a door and fin".println("You walk through a door and fin".println("You walk through a door and fin".println("You walk through a door and fin".println("You walk through a door and fin".println("You walk through a door and fin" + "d a teacher and a bunch of kids sitting " + "d a teacher and a bunch of kids sitting " + "d a teacher and a bunch of kids sitting " + "d a teacher and a bunch of kids sitting " + "d a teacher and a bunch of kids sitting " + "d a teacher and a bunch of kids sitting " + "at desks."); + "at desks."); + "at desks."); + "at desks."); + "at desks."); + "at desks."); + "at desks."); + "at desks."); System. System. System.out.println("Pirate: 'Ay good, we got us a l".println("Pirate: 'Ay good, we got us a l".println("Pirate: 'Ay good, we got us a l".println("Pirate: 'Ay good, we got us a l".println("Pirate: 'Ay good, we got us a l".println("Pirate: 'Ay good, we got us a l" + "ive one kids!'"); + "ive one kids!'"); + "ive one kids!'"); + "ive one kids!'"); + "ive one kids!'"); + "ive one kids!'"); + "ive one kids!'"); + "ive one kids!'"); System. System. System.out.println("The kids cheer and bang on thei".println("The kids cheer and bang on thei".println("The kids cheer and bang on thei".println("The kids cheer and bang on thei".println("The kids cheer and bang on thei".println("The kids cheer and bang on thei" + "r desks loudly."); + "r desks loudly."); + "r desks loudly."); + "r desks loudly."); + "r desks loudly."); + "r desks loudly."); + "r desks loudly."); + "r desks loudly."); System. System. System.out.println("Pirate: 'Okay settle down ye mo".println("Pirate: 'Okay settle down ye mo".println("Pirate: 'Okay settle down ye mo".println("Pirate: 'Okay settle down ye mo".println("Pirate: 'Okay settle down ye mo".println("Pirate: 'Okay settle down ye mo" + "nsters. Greeting boy, we want to as a fa" + "nsters. Greeting boy, we want to as a fa" + "nsters. Greeting boy, we want to as a fa" + "nsters. Greeting boy, we want to as a fa" + "nsters. Greeting boy, we want to as a fa" + "nsters. Greeting boy, we want to as a fa" + "vor of ya.'"); + "vor of ya.'"); + "vor of ya.'"); + "vor of ya.'"); + "vor of ya.'"); + "vor of ya.'"); + "vor of ya.'"); + "vor of ya.'"); System. System. System.out.println("You notice and pistol in his po".println("You notice and pistol in his po".println("You notice and pistol in his po".println("You notice and pistol in his po".println("You notice and pistol in his po".println("You notice and pistol in his po" + "cket and nod."); + "cket and nod."); + "cket and nod."); + "cket and nod."); + "cket and nod."); + "cket and nod."); + "cket and nod."); + "cket and nod."); arraySum. arraySum. arraySum.arraySumKing();();(); System. System. System.out.println("Pirate: 'Thank ye boy, you may ".println("Pirate: 'Thank ye boy, you may ".println("Pirate: 'Thank ye boy, you may ".println("Pirate: 'Thank ye boy, you may ".println("Pirate: 'Thank ye boy, you may ".println("Pirate: 'Thank ye boy, you may " + "go.'"); + "go.'"); + "go.'"); + "go.'"); + "go.'"); + "go.'"); + "go.'"); + "go.'"); scan++; //kills loop scan++; //kills loop scan++; //kills loop scan++; //kills loop scan++; //kills loop scan++; //kills loop } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter numbers only.");.println("Please enter numbers only.");.println("Please enter numbers only.");.println("Please enter numbers only.");.println("Please enter numbers only.");.println("Please enter numbers only.");.println("Please enter numbers only.");.println("Please enter numbers only."); } } } } break; break; break; case 2: case 2: case 2: case 2: case 2: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { try { System. System. System.out.println("Jones: 'Oh, what fortuitous cer".println("Jones: 'Oh, what fortuitous cer".println("Jones: 'Oh, what fortuitous cer".println("Jones: 'Oh, what fortuitous cer".println("Jones: 'Oh, what fortuitous cer".println("Jones: 'Oh, what fortuitous cer" + "cumstances be this, a crew member i have" + "cumstances be this, a crew member i have" + "cumstances be this, a crew member i have" + "cumstances be this, a crew member i have" + "cumstances be this, a crew member i have" + "cumstances be this, a crew member i have" + " yet to lay my eyes on. A piece of, fres" + " yet to lay my eyes on. A piece of, fres" + " yet to lay my eyes on. A piece of, fres" + " yet to lay my eyes on. A piece of, fres" + " yet to lay my eyes on. A piece of, fres" + " yet to lay my eyes on. A piece of, fres" + "h meat.'"); + "h meat.'"); + "h meat.'"); + "h meat.'"); + "h meat.'"); + "h meat.'"); + "h meat.'"); + "h meat.'");

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/arrays.java

1.1 of 2 2014.12.03 14:33:18

Page 14: Text adventure

737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119

+ "h meat.'"); + "h meat.'"); + "h meat.'"); + "h meat.'"); + "h meat.'"); + "h meat.'"); + "h meat.'"); + "h meat.'"); System. System. System.out.println("You try to back away but two me".println("You try to back away but two me".println("You try to back away but two me".println("You try to back away but two me".println("You try to back away but two me".println("You try to back away but two me" + "n now gaurd the doors."); + "n now gaurd the doors."); + "n now gaurd the doors."); + "n now gaurd the doors."); + "n now gaurd the doors."); + "n now gaurd the doors."); + "n now gaurd the doors."); + "n now gaurd the doors."); System. System. System.out.println("Jones: 'Oh my scared friend, no".println("Jones: 'Oh my scared friend, no".println("Jones: 'Oh my scared friend, no".println("Jones: 'Oh my scared friend, no".println("Jones: 'Oh my scared friend, no".println("Jones: 'Oh my scared friend, no" + " need to run, I just want to play a quic" + " need to run, I just want to play a quic" + " need to run, I just want to play a quic" + " need to run, I just want to play a quic" + " need to run, I just want to play a quic" + " need to run, I just want to play a quic" + "k game."); + "k game."); + "k game."); + "k game."); + "k game."); + "k game."); + "k game."); + "k game."); System. System. System.out.println("You nod and try to get done as ".println("You nod and try to get done as ".println("You nod and try to get done as ".println("You nod and try to get done as ".println("You nod and try to get done as ".println("You nod and try to get done as " + "fast as possible."); + "fast as possible."); + "fast as possible."); + "fast as possible."); + "fast as possible."); + "fast as possible."); + "fast as possible."); + "fast as possible."); evenOnly. evenOnly. evenOnly.evenOnlyKing();();(); System. System. System.out.println("You nod and leave.");.println("You nod and leave.");.println("You nod and leave.");.println("You nod and leave.");.println("You nod and leave.");.println("You nod and leave.");.println("You nod and leave.");.println("You nod and leave."); scan++; //kills loop scan++; //kills loop scan++; //kills loop scan++; //kills loop scan++; //kills loop scan++; //kills loop } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter numbers only.");.println("Please enter numbers only.");.println("Please enter numbers only.");.println("Please enter numbers only.");.println("Please enter numbers only.");.println("Please enter numbers only.");.println("Please enter numbers only.");.println("Please enter numbers only."); } } } } break; break; break; case 3: case 3: case 3: case 3: case 3: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { System. System. System.out.println("You enter the room and a lovely".println("You enter the room and a lovely".println("You enter the room and a lovely".println("You enter the room and a lovely".println("You enter the room and a lovely".println("You enter the room and a lovely" + " woman greets you."); + " woman greets you."); + " woman greets you."); + " woman greets you."); + " woman greets you."); + " woman greets you."); + " woman greets you."); + " woman greets you."); System. System. System.out.println("Woman: 'Oh hello there darlin, ".println("Woman: 'Oh hello there darlin, ".println("Woman: 'Oh hello there darlin, ".println("Woman: 'Oh hello there darlin, ".println("Woman: 'Oh hello there darlin, ".println("Woman: 'Oh hello there darlin, " + "just sit down and i'll tell your fortune" + "just sit down and i'll tell your fortune" + "just sit down and i'll tell your fortune" + "just sit down and i'll tell your fortune" + "just sit down and i'll tell your fortune" + "just sit down and i'll tell your fortune" + "'"); + "'"); + "'"); + "'"); + "'"); + "'"); + "'"); + "'"); System. System. System.out.println("You sit in the chair and for th".println("You sit in the chair and for th".println("You sit in the chair and for th".println("You sit in the chair and for th".println("You sit in the chair and for th".println("You sit in the chair and for th" + "e first time you aren't scared."); + "e first time you aren't scared."); + "e first time you aren't scared."); + "e first time you aren't scared."); + "e first time you aren't scared."); + "e first time you aren't scared."); + "e first time you aren't scared."); + "e first time you aren't scared."); smallXLarge. smallXLarge. smallXLarge.smallXLargeKing();();(); System. System. System.out.println("You smile, thank the woman and ".println("You smile, thank the woman and ".println("You smile, thank the woman and ".println("You smile, thank the woman and ".println("You smile, thank the woman and ".println("You smile, thank the woman and " + "walk out of the room."); + "walk out of the room."); + "walk out of the room."); + "walk out of the room."); + "walk out of the room."); + "walk out of the room."); + "walk out of the room."); + "walk out of the room."); scan++; //kills loop scan++; //kills loop scan++; //kills loop scan++; //kills loop scan++; //kills loop scan++; //kills loop } catch (Exception e) { // possible death scenario } catch (Exception e) { // possible death scenario } catch (Exception e) { // possible death scenario } catch (Exception e) { // possible death scenario } catch (Exception e) { // possible death scenario } catch (Exception e) { // possible death scenario } catch (Exception e) { // possible death scenario } catch (Exception e) { // possible death scenario } catch (Exception e) { // possible death scenario } catch (Exception e) { // possible death scenario } catch (Exception e) { // possible death scenario } catch (Exception e) { // possible death scenario } catch (Exception e) { // possible death scenario } catch (Exception e) { // possible death scenario System. System. System.out.println("woman: 'YOU BRAT! I SAID GIVE M".println("woman: 'YOU BRAT! I SAID GIVE M".println("woman: 'YOU BRAT! I SAID GIVE M".println("woman: 'YOU BRAT! I SAID GIVE M".println("woman: 'YOU BRAT! I SAID GIVE M".println("woman: 'YOU BRAT! I SAID GIVE M" + "E NUMBERS AND YOU DID THIS! I guess you " + "E NUMBERS AND YOU DID THIS! I guess you " + "E NUMBERS AND YOU DID THIS! I guess you " + "E NUMBERS AND YOU DID THIS! I guess you " + "E NUMBERS AND YOU DID THIS! I guess you " + "E NUMBERS AND YOU DID THIS! I guess you " + "want to die."); + "want to die."); + "want to die."); + "want to die."); + "want to die."); + "want to die."); + "want to die."); + "want to die."); System. System. System.out.println("The woman stabs you and cuts ou".println("The woman stabs you and cuts ou".println("The woman stabs you and cuts ou".println("The woman stabs you and cuts ou".println("The woman stabs you and cuts ou".println("The woman stabs you and cuts ou" + "t your heart"); + "t your heart"); + "t your heart"); + "t your heart"); + "t your heart"); + "t your heart"); + "t your heart"); + "t your heart"); System. System. System.out.println("This is what happens when you d".println("This is what happens when you d".println("This is what happens when you d".println("This is what happens when you d".println("This is what happens when you d".println("This is what happens when you d" + "ont follow directions, go back and try a" + "ont follow directions, go back and try a" + "ont follow directions, go back and try a" + "ont follow directions, go back and try a" + "ont follow directions, go back and try a" + "ont follow directions, go back and try a" + "gain."); + "gain."); + "gain."); + "gain."); + "gain."); + "gain."); + "gain."); + "gain."); } } } } } } } }

} }}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/arrays.java

2.1 of 2 2014.12.03 14:33:18

Page 15: Text adventure

1234567891011121314151617181920212223242526272829303132333435363738394041424344

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class arraySum { {

public static void public static void public static void public static void public static void public static void public static void arraySumKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in); ); ); int sum = 0; int sum = 0; int sum = 0; int sum = 0; int sum = 0; int sum = 0; int sum = 0; int sum = 0; int sum = 0; int a[] = new int[10]; // array with 10 values int a[] = new int[10]; // array with 10 values int a[] = new int[10]; // array with 10 values int a[] = new int[10]; // array with 10 values int a[] = new int[10]; // array with 10 values int a[] = new int[10]; // array with 10 values int a[] = new int[10]; // array with 10 values int a[] = new int[10]; // array with 10 values int a[] = new int[10]; // array with 10 values int a[] = new int[10]; // array with 10 values int a[] = new int[10]; // array with 10 values int a[] = new int[10]; // array with 10 values int a[] = new int[10]; // array with 10 values int a[] = new int[10]; // array with 10 values int a[] = new int[10]; // array with 10 values int a[] = new int[10]; // array with 10 values int a[] = new int[10]; // array with 10 values int a[] = new int[10]; // array with 10 values System. System. System.out.println("Pirate: 'Ok ya wee laddeh, give us 10 numbers for t".println("Pirate: 'Ok ya wee laddeh, give us 10 numbers for t".println("Pirate: 'Ok ya wee laddeh, give us 10 numbers for t".println("Pirate: 'Ok ya wee laddeh, give us 10 numbers for t".println("Pirate: 'Ok ya wee laddeh, give us 10 numbers for t".println("Pirate: 'Ok ya wee laddeh, give us 10 numbers for t" + "he wee kids to add.'"); + "he wee kids to add.'"); + "he wee kids to add.'"); + "he wee kids to add.'"); + "he wee kids to add.'"); + "he wee kids to add.'"); + "he wee kids to add.'"); + "he wee kids to add.'"); // fills the array // fills the array for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { a[i] = in.nextInt(); a[i] = in.nextInt(); a[i] = in.nextInt(); a[i] = in.nextInt(); a[i] = in.nextInt(); a[i] = in.nextInt(); a[i] = in.nextInt(); a[i] = in.nextInt(); a[i] = in.nextInt(); a[i] = in.nextInt(); a[i] = in.nextInt(); a[i] = in.nextInt(); a[i] = in.nextInt(); a[i] = in.nextInt(); if (i == 9) { if (i == 9) { if (i == 9) { if (i == 9) { if (i == 9) { if (i == 9) { if (i == 9) { if (i == 9) { if (i == 9) { if (i == 9) { if (i == 9) { if (i == 9) { break; break; break; } } } }

// adds the values of the array // adds the values of the array for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) { sum += a[i]; sum += a[i]; sum += a[i]; sum += a[i]; sum += a[i]; sum += a[i]; sum += a[i]; sum += a[i]; sum += a[i]; sum += a[i]; sum += a[i]; } }

System. System. System.out.println("Kids: 'The sum of..'");.println("Kids: 'The sum of..'");.println("Kids: 'The sum of..'");.println("Kids: 'The sum of..'");.println("Kids: 'The sum of..'");.println("Kids: 'The sum of..'");.println("Kids: 'The sum of..'");.println("Kids: 'The sum of..'"); System. System. System.out.println("The pirate teacher places a hand on his pistol");.println("The pirate teacher places a hand on his pistol");.println("The pirate teacher places a hand on his pistol");.println("The pirate teacher places a hand on his pistol");.println("The pirate teacher places a hand on his pistol");.println("The pirate teacher places a hand on his pistol");.println("The pirate teacher places a hand on his pistol");.println("The pirate teacher places a hand on his pistol"); System. System. System.out.println("Kids: 'The combined value of ye numbers be " + sum);.println("Kids: 'The combined value of ye numbers be " + sum);.println("Kids: 'The combined value of ye numbers be " + sum);.println("Kids: 'The combined value of ye numbers be " + sum);.println("Kids: 'The combined value of ye numbers be " + sum);.println("Kids: 'The combined value of ye numbers be " + sum);.println("Kids: 'The combined value of ye numbers be " + sum);.println("Kids: 'The combined value of ye numbers be " + sum);.println("Kids: 'The combined value of ye numbers be " + sum);.println("Kids: 'The combined value of ye numbers be " + sum);.println("Kids: 'The combined value of ye numbers be " + sum);.println("Kids: 'The combined value of ye numbers be " + sum); System. System. System.out.println("The pirate teacher smiles and nods.");.println("The pirate teacher smiles and nods.");.println("The pirate teacher smiles and nods.");.println("The pirate teacher smiles and nods.");.println("The pirate teacher smiles and nods.");.println("The pirate teacher smiles and nods.");.println("The pirate teacher smiles and nods.");.println("The pirate teacher smiles and nods."); } }

}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/arraySum.java

1.1 of 1 2014.12.03 14:33:01

Page 16: Text adventure

12345678910111213141516171819202122232425262728293031323334353637383940414243444546

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class boxOfNumbers { {

public static void public static void public static void public static void public static void public static void public static void boxOfNumbersKing() {() {() {() {

Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in); ); );

System. System. System.out.println("Clown: 'What's your height?'");.println("Clown: 'What's your height?'");.println("Clown: 'What's your height?'");.println("Clown: 'What's your height?'");.println("Clown: 'What's your height?'");.println("Clown: 'What's your height?'");.println("Clown: 'What's your height?'");.println("Clown: 'What's your height?'"); int height = in.nextInt(); int height = in.nextInt(); int height = in.nextInt(); int height = in.nextInt(); int height = in.nextInt(); int height = in.nextInt(); int height = in.nextInt(); int height = in.nextInt(); int height = in.nextInt(); int height = in.nextInt(); int height = in.nextInt(); int height = in.nextInt(); int height = in.nextInt();

System. System. System.out.println("Clown: 'And your width?'");.println("Clown: 'And your width?'");.println("Clown: 'And your width?'");.println("Clown: 'And your width?'");.println("Clown: 'And your width?'");.println("Clown: 'And your width?'");.println("Clown: 'And your width?'");.println("Clown: 'And your width?'"); int width = in.nextInt(); int width = in.nextInt(); int width = in.nextInt(); int width = in.nextInt(); int width = in.nextInt(); int width = in.nextInt(); int width = in.nextInt(); int width = in.nextInt(); int width = in.nextInt(); int width = in.nextInt(); int width = in.nextInt(); int width = in.nextInt(); int width = in.nextInt();

int col; // collums int col; // collums int col; // collums int col; // collums int col; // collums int col; // collums int col; // collums int row = 1; // rows int row = 1; // rows int row = 1; // rows int row = 1; // rows int row = 1; // rows int row = 1; // rows int row = 1; // rows int row = 1; // rows int row = 1; // rows int row = 1; // rows int row = 1; // rows System. System. System.out.println("The clown claps his hands and");.println("The clown claps his hands and");.println("The clown claps his hands and");.println("The clown claps his hands and");.println("The clown claps his hands and");.println("The clown claps his hands and");.println("The clown claps his hands and");.println("The clown claps his hands and");

// this will later be used to multiply matricies together // this will later be used to multiply matricies together while (row <= height) { while (row <= height) { while (row <= height) { while (row <= height) { while (row <= height) { while (row <= height) { while (row <= height) { while (row <= height) { while (row <= height) { while (row <= height) { while (row <= height) { while (row <= height) { System. System. System.out.println("");.println("");.println("");.println("");.println("");.println(""); row++; row++; row++; row++; col = 1; col = 1; col = 1; col = 1; col = 1; col = 1; col = 1; while (col <= width) { while (col <= width) { while (col <= width) { while (col <= width) { while (col <= width) { while (col <= width) { while (col <= width) { while (col <= width) { while (col <= width) { while (col <= width) { while (col <= width) { while (col <= width) { System. System. System.out.print("#");.print("#");.print("#");.print("#");.print("#");.print("#");.print("#");.print("#"); col++; col++; col++; col++; } } } } System. System. System.out.println("");.println("");.println("");.println("");.println("");.println(""); System. System. System.out.println("appears in the air"); .println("appears in the air"); .println("appears in the air"); .println("appears in the air"); .println("appears in the air"); .println("appears in the air"); .println("appears in the air"); .println("appears in the air"); .println("appears in the air"); } }}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/boxOfNumbers.java

1.1 of 1 2014.12.03 15:03:30

Page 17: Text adventure

12345678910111213141516171819202122232425262728

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

public class public class public class public class challenge extends iEquals3 { // gets all them operations extends iEquals3 { // gets all them operations extends iEquals3 { // gets all them operations extends iEquals3 { // gets all them operations extends iEquals3 { // gets all them operations extends iEquals3 { // gets all them operations extends iEquals3 { // gets all them operations extends iEquals3 { // gets all them operations

void void void iEquals3King() {() {() {() {

iEquals3 equal = new iEquals3(); iEquals3 equal = new iEquals3(); iEquals3 equal = new iEquals3(); iEquals3 equal = new iEquals3(); iEquals3 equal = new iEquals3(); iEquals3 equal = new iEquals3(); iEquals3 equal = new iEquals3(); iEquals3 equal = new iEquals3(); iEquals3 equal = new iEquals3(); iEquals3 equal = new iEquals3(); iEquals3 equal = new iEquals3(); iEquals3 equal = new iEquals3(); iEquals3 equal = new iEquals3();

for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) { equal.increment(); equal.increment(); equal.increment(); equal.increment(); equal.increment(); equal.increment(); equal.increment(); } }

equal.print(); equal.print(); equal.print(); equal.print(); equal.print(); equal.print(); equal.print();

} }}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/challenge.java

1.1 of 1 2014.12.03 14:17:52

Page 18: Text adventure

123456789101112131415161718192021222324252627282930313233343536373839

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

class class chooseANumber { {

public static void public static void public static void public static void public static void public static void public static void chooseANumberKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in);); System. System. System.out.println("Negeki: 'Have you guessed the number?'");.println("Negeki: 'Have you guessed the number?'");.println("Negeki: 'Have you guessed the number?'");.println("Negeki: 'Have you guessed the number?'");.println("Negeki: 'Have you guessed the number?'");.println("Negeki: 'Have you guessed the number?'");.println("Negeki: 'Have you guessed the number?'");.println("Negeki: 'Have you guessed the number?'"); int input = in.nextInt(); int input = in.nextInt(); int input = in.nextInt(); int input = in.nextInt(); int input = in.nextInt(); int input = in.nextInt(); int input = in.nextInt(); int input = in.nextInt(); int input = in.nextInt(); int input = in.nextInt(); int input = in.nextInt(); int input = in.nextInt(); int input = in.nextInt(); try { try { try { try { // checks if the number is divisable by both 5 and 2 // checks if the number is divisable by both 5 and 2 if (input % 5 == 0 && input % 2 == 0) { if (input % 5 == 0 && input % 2 == 0) { if (input % 5 == 0 && input % 2 == 0) { if (input % 5 == 0 && input % 2 == 0) { if (input % 5 == 0 && input % 2 == 0) { if (input % 5 == 0 && input % 2 == 0) { if (input % 5 == 0 && input % 2 == 0) { if (input % 5 == 0 && input % 2 == 0) { if (input % 5 == 0 && input % 2 == 0) { if (input % 5 == 0 && input % 2 == 0) { if (input % 5 == 0 && input % 2 == 0) { if (input % 5 == 0 && input % 2 == 0) { if (input % 5 == 0 && input % 2 == 0) { if (input % 5 == 0 && input % 2 == 0) { if (input % 5 == 0 && input % 2 == 0) { if (input % 5 == 0 && input % 2 == 0) { if (input % 5 == 0 && input % 2 == 0) { if (input % 5 == 0 && input % 2 == 0) { if (input % 5 == 0 && input % 2 == 0) { if (input % 5 == 0 && input % 2 == 0) { if (input % 5 == 0 && input % 2 == 0) { if (input % 5 == 0 && input % 2 == 0) { if (input % 5 == 0 && input % 2 == 0) { if (input % 5 == 0 && input % 2 == 0) { if (input % 5 == 0 && input % 2 == 0) { if (input % 5 == 0 && input % 2 == 0) { if (input % 5 == 0 && input % 2 == 0) { if (input % 5 == 0 && input % 2 == 0) { System. System. System.out.println("Negeki: 'correct, thank you, no one ever ".println("Negeki: 'correct, thank you, no one ever ".println("Negeki: 'correct, thank you, no one ever ".println("Negeki: 'correct, thank you, no one ever ".println("Negeki: 'correct, thank you, no one ever ".println("Negeki: 'correct, thank you, no one ever " + "talks to me'"); + "talks to me'"); + "talks to me'"); + "talks to me'"); + "talks to me'"); + "talks to me'"); + "talks to me'"); + "talks to me'"); System. System. System.out.println("He vanishes and you walk out of the room");.println("He vanishes and you walk out of the room");.println("He vanishes and you walk out of the room");.println("He vanishes and you walk out of the room");.println("He vanishes and you walk out of the room");.println("He vanishes and you walk out of the room");.println("He vanishes and you walk out of the room");.println("He vanishes and you walk out of the room"); } else { } else { } else { } else { } else { } else { throw new NumberFormatException(); throw new NumberFormatException(); throw new NumberFormatException(); throw new NumberFormatException(); throw new NumberFormatException(); throw new NumberFormatException(); throw new NumberFormatException(); throw new NumberFormatException(); throw new NumberFormatException(); } } } catch (NumberFormatException e) { } catch (NumberFormatException e) { } catch (NumberFormatException e) { } catch (NumberFormatException e) { } catch (NumberFormatException e) { } catch (NumberFormatException e) { } catch (NumberFormatException e) { } catch (NumberFormatException e) { } catch (NumberFormatException e) { } catch (NumberFormatException e) { } catch (NumberFormatException e) { } catch (NumberFormatException e) { System. System. System.out.println("Negeki: 'Wrong, thank you for talking to me".println("Negeki: 'Wrong, thank you for talking to me".println("Negeki: 'Wrong, thank you for talking to me".println("Negeki: 'Wrong, thank you for talking to me".println("Negeki: 'Wrong, thank you for talking to me".println("Negeki: 'Wrong, thank you for talking to me" + " ever since the accident it seems that everyone avoids" + " ever since the accident it seems that everyone avoids" + " ever since the accident it seems that everyone avoids" + " ever since the accident it seems that everyone avoids" + " ever since the accident it seems that everyone avoids" + " ever since the accident it seems that everyone avoids" + " me"); + " me"); + " me"); + " me"); + " me"); + " me"); + " me"); + " me");

} } } }}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/chooseANumber.java

1.1 of 1 2014.12.03 14:44:33

Page 19: Text adventure

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

class class circleColor { {

public static void public static void public static void public static void public static void public static void public static void circlecolorKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in); // in because patterns); // in because patterns); // in because patterns); // in because patterns int sum = 0; int sum = 0; int sum = 0; int sum = 0; int sum = 0; int sum = 0; int sum = 0; int sum = 0; int sum = 0; System. System. System.out.println("What is the radius in killometers?");.println("What is the radius in killometers?");.println("What is the radius in killometers?");.println("What is the radius in killometers?");.println("What is the radius in killometers?");.println("What is the radius in killometers?");.println("What is the radius in killometers?");.println("What is the radius in killometers?"); double r = in.nextInt(); double r = in.nextInt(); double r = in.nextInt(); double r = in.nextInt(); double r = in.nextInt(); double r = in.nextInt(); double r = in.nextInt(); double r = in.nextInt(); double r = in.nextInt(); double r = in.nextInt(); double r = in.nextInt(); double r = in.nextInt(); double r = in.nextInt(); if (70 <= r && r <= 80) { // actual radius of death star in movies. if (70 <= r && r <= 80) { // actual radius of death star in movies. if (70 <= r && r <= 80) { // actual radius of death star in movies. if (70 <= r && r <= 80) { // actual radius of death star in movies. if (70 <= r && r <= 80) { // actual radius of death star in movies. if (70 <= r && r <= 80) { // actual radius of death star in movies. if (70 <= r && r <= 80) { // actual radius of death star in movies. if (70 <= r && r <= 80) { // actual radius of death star in movies. if (70 <= r && r <= 80) { // actual radius of death star in movies. if (70 <= r && r <= 80) { // actual radius of death star in movies. if (70 <= r && r <= 80) { // actual radius of death star in movies. if (70 <= r && r <= 80) { // actual radius of death star in movies. if (70 <= r && r <= 80) { // actual radius of death star in movies. if (70 <= r && r <= 80) { // actual radius of death star in movies. if (70 <= r && r <= 80) { // actual radius of death star in movies. if (70 <= r && r <= 80) { // actual radius of death star in movies. if (70 <= r && r <= 80) { // actual radius of death star in movies. if (70 <= r && r <= 80) { // actual radius of death star in movies. if (70 <= r && r <= 80) { // actual radius of death star in movies. if (70 <= r && r <= 80) { // actual radius of death star in movies. if (70 <= r && r <= 80) { // actual radius of death star in movies. if (70 <= r && r <= 80) { // actual radius of death star in movies. System. System. System.out.println("Trooper: 'huh, thats roughly the same size this".println("Trooper: 'huh, thats roughly the same size this".println("Trooper: 'huh, thats roughly the same size this".println("Trooper: 'huh, thats roughly the same size this".println("Trooper: 'huh, thats roughly the same size this".println("Trooper: 'huh, thats roughly the same size this" + " one is, good choice.'"); + " one is, good choice.'"); + " one is, good choice.'"); + " one is, good choice.'"); + " one is, good choice.'"); + " one is, good choice.'"); + " one is, good choice.'"); + " one is, good choice.'"); } } myCircle user = new myCircle(); myCircle user = new myCircle(); myCircle user = new myCircle(); myCircle user = new myCircle(); myCircle user = new myCircle(); myCircle user = new myCircle(); myCircle user = new myCircle(); myCircle user = new myCircle(); myCircle user = new myCircle(); myCircle user = new myCircle(); myCircle user = new myCircle(); myCircle user = new myCircle(); myCircle user = new myCircle(); user.setRadius(r); // making sure the radius is at least 1 user.setRadius(r); // making sure the radius is at least 1 user.setRadius(r); // making sure the radius is at least 1 user.setRadius(r); // making sure the radius is at least 1 user.setRadius(r); // making sure the radius is at least 1 user.setRadius(r); // making sure the radius is at least 1 user.setRadius(r); // making sure the radius is at least 1 user.setRadius(r); // making sure the radius is at least 1 user.setRadius(r); // making sure the radius is at least 1 user.setRadius(r); // making sure the radius is at least 1 System. System. System.out.println("what color should it be?");.println("what color should it be?");.println("what color should it be?");.println("what color should it be?");.println("what color should it be?");.println("what color should it be?");.println("what color should it be?");.println("what color should it be?"); String col = in.next(); //color is a string String col = in.next(); //color is a string String col = in.next(); //color is a string String col = in.next(); //color is a string String col = in.next(); //color is a string String col = in.next(); //color is a string String col = in.next(); //color is a string String col = in.next(); //color is a string String col = in.next(); //color is a string String col = in.next(); //color is a string String col = in.next(); //color is a string String col = in.next(); //color is a string String col = in.next(); //color is a string String col = in.next(); //color is a string String col = in.next(); //color is a string System. System. System.out.println(user.getArea()); // calulate area.println(user.getArea()); // calulate area.println(user.getArea()); // calulate area.println(user.getArea()); // calulate area.println(user.getArea()); // calulate area.println(user.getArea()); // calulate area.println(user.getArea()); // calulate area.println(user.getArea()); // calulate area.println(user.getArea()); // calulate area.println(user.getArea()); // calulate area.println(user.getArea()); // calulate area.println(user.getArea()); // calulate area System. System. System.out.println(col); // the color.println(col); // the color.println(col); // the color.println(col); // the color.println(col); // the color.println(col); // the color.println(col); // the color.println(col); // the color } }

}

class class myCircle { {

private double radius; private double radius; private double radius; private double radius; private double radius; private double radius; private double radius;

public void public void public void public void public void setRadius(double r) {(double r) {(double r) {(double r) {(double r) {(double r) {(double r) { if (r > 0) { if (r > 0) { if (r > 0) { if (r > 0) { if (r > 0) { if (r > 0) { if (r > 0) { if (r > 0) { if (r > 0) { if (r > 0) { if (r > 0) { if (r > 0) { radius = r; radius = r; radius = r; radius = r; radius = r; radius = r; radius = r; } else { } else { } else { } else { } else { } else { radius = 1; radius = 1; radius = 1; radius = 1; radius = 1; radius = 1; radius = 1; } } } }

public double public double public double public double public double getArea() {() {() {() { double area; double area; double area; double area; double area; area = (3.141592653589793) * radius * radius; //pi is a big small number area = (3.141592653589793) * radius * radius; //pi is a big small number area = (3.141592653589793) * radius * radius; //pi is a big small number area = (3.141592653589793) * radius * radius; //pi is a big small number area = (3.141592653589793) * radius * radius; //pi is a big small number area = (3.141592653589793) * radius * radius; //pi is a big small number area = (3.141592653589793) * radius * radius; //pi is a big small number area = (3.141592653589793) * radius * radius; //pi is a big small number area = (3.141592653589793) * radius * radius; //pi is a big small number area = (3.141592653589793) * radius * radius; //pi is a big small number area = (3.141592653589793) * radius * radius; //pi is a big small number area = (3.141592653589793) * radius * radius; //pi is a big small number area = (3.141592653589793) * radius * radius; //pi is a big small number area = (3.141592653589793) * radius * radius; //pi is a big small number area = (3.141592653589793) * radius * radius; //pi is a big small number area = (3.141592653589793) * radius * radius; //pi is a big small number area = (3.141592653589793) * radius * radius; //pi is a big small number area = (3.141592653589793) * radius * radius; //pi is a big small number area = (3.141592653589793) * radius * radius; //pi is a big small number return area; return area; return area; return area; return area; } }}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/circleColor.java

1.1 of 1 2014.12.03 14:38:54

Page 20: Text adventure

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class classes { {

public static void public static void public static void public static void public static void public static void public static void classesKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in); ); ); int classChoice = 0, scan = 0; int classChoice = 0, scan = 0; int classChoice = 0, scan = 0; int classChoice = 0, scan = 0; int classChoice = 0, scan = 0; int classChoice = 0, scan = 0; int classChoice = 0, scan = 0; int classChoice = 0, scan = 0; int classChoice = 0, scan = 0; int classChoice = 0, scan = 0; int classChoice = 0, scan = 0; int classChoice = 0, scan = 0; int classChoice = 0, scan = 0; int classChoice = 0, scan = 0; int classChoice = 0, scan = 0; int classChoice = 0, scan = 0; System. System. System.out.println("you reach an elivator and get launched into sp".println("you reach an elivator and get launched into sp".println("you reach an elivator and get launched into sp".println("you reach an elivator and get launched into sp".println("you reach an elivator and get launched into sp".println("you reach an elivator and get launched into sp" + "ace, after a 20 minute journy the doors open and a man" + "ace, after a 20 minute journy the doors open and a man" + "ace, after a 20 minute journy the doors open and a man" + "ace, after a 20 minute journy the doors open and a man" + "ace, after a 20 minute journy the doors open and a man" + "ace, after a 20 minute journy the doors open and a man" + "greets you."); + "greets you."); + "greets you."); + "greets you."); + "greets you."); + "greets you."); + "greets you."); + "greets you."); System. System. System.out.println("Grunt: 'hello new recruit, we are here to defe".println("Grunt: 'hello new recruit, we are here to defe".println("Grunt: 'hello new recruit, we are here to defe".println("Grunt: 'hello new recruit, we are here to defe".println("Grunt: 'hello new recruit, we are here to defe".println("Grunt: 'hello new recruit, we are here to defe" + "at these enemies of peace called Jedi."); + "at these enemies of peace called Jedi."); + "at these enemies of peace called Jedi."); + "at these enemies of peace called Jedi."); + "at these enemies of peace called Jedi."); + "at these enemies of peace called Jedi."); + "at these enemies of peace called Jedi."); + "at these enemies of peace called Jedi."); System. System. System.out.println("Grunt: 'You have two ways to help out here and ".println("Grunt: 'You have two ways to help out here and ".println("Grunt: 'You have two ways to help out here and ".println("Grunt: 'You have two ways to help out here and ".println("Grunt: 'You have two ways to help out here and ".println("Grunt: 'You have two ways to help out here and " + "one relaxation area."); + "one relaxation area."); + "one relaxation area."); + "one relaxation area."); + "one relaxation area."); + "one relaxation area."); + "one relaxation area."); + "one relaxation area."); while (classChoice != 4) { while (classChoice != 4) { while (classChoice != 4) { while (classChoice != 4) { while (classChoice != 4) { while (classChoice != 4) { while (classChoice != 4) { while (classChoice != 4) { while (classChoice != 4) { while (classChoice != 4) { while (classChoice != 4) { while (classChoice != 4) { scan = 0; scan = 0; scan = 0; scan = 0; scan = 0; scan = 0; scan = 0; System. System. System.out.println("Grunt: 'You can go to the 1:Design area, 2:Dar".println("Grunt: 'You can go to the 1:Design area, 2:Dar".println("Grunt: 'You can go to the 1:Design area, 2:Dar".println("Grunt: 'You can go to the 1:Design area, 2:Dar".println("Grunt: 'You can go to the 1:Design area, 2:Dar".println("Grunt: 'You can go to the 1:Design area, 2:Dar" + "h vader book signing, 3:Targeting area, or 4:Leave."); + "h vader book signing, 3:Targeting area, or 4:Leave."); + "h vader book signing, 3:Targeting area, or 4:Leave."); + "h vader book signing, 3:Targeting area, or 4:Leave."); + "h vader book signing, 3:Targeting area, or 4:Leave."); + "h vader book signing, 3:Targeting area, or 4:Leave."); + "h vader book signing, 3:Targeting area, or 4:Leave."); + "h vader book signing, 3:Targeting area, or 4:Leave."); classChoice = in.nextInt(); classChoice = in.nextInt(); classChoice = in.nextInt(); classChoice = in.nextInt(); classChoice = in.nextInt(); classChoice = in.nextInt(); classChoice = in.nextInt(); classChoice = in.nextInt(); classChoice = in.nextInt(); classChoice = in.nextInt(); classChoice = in.nextInt(); switch (classChoice) { switch (classChoice) { switch (classChoice) { switch (classChoice) { switch (classChoice) { switch (classChoice) { switch (classChoice) { switch (classChoice) { case 1: case 1: case 1: case 1: case 1: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { System. System. System.out.println("You enter the design area and ".println("You enter the design area and ".println("You enter the design area and ".println("You enter the design area and ".println("You enter the design area and ".println("You enter the design area and " + "there is a storm trooper there to greet" + "there is a storm trooper there to greet" + "there is a storm trooper there to greet" + "there is a storm trooper there to greet" + "there is a storm trooper there to greet" + "there is a storm trooper there to greet" + "you."); + "you."); + "you."); + "you."); + "you."); + "you."); + "you."); + "you."); System. System. System.out.println("Trooper: 'Hello soldier! We are".println("Trooper: 'Hello soldier! We are".println("Trooper: 'Hello soldier! We are".println("Trooper: 'Hello soldier! We are".println("Trooper: 'Hello soldier! We are".println("Trooper: 'Hello soldier! We are" + " creating more Death Stars in order to h" + " creating more Death Stars in order to h" + " creating more Death Stars in order to h" + " creating more Death Stars in order to h" + " creating more Death Stars in order to h" + " creating more Death Stars in order to h" + "elp the peaceful takeover of the galaxy" + "elp the peaceful takeover of the galaxy" + "elp the peaceful takeover of the galaxy" + "elp the peaceful takeover of the galaxy" + "elp the peaceful takeover of the galaxy" + "elp the peaceful takeover of the galaxy" + ".'"); + ".'"); + ".'"); + ".'"); + ".'"); + ".'"); + ".'"); + ".'"); System. System. System.out.println("Trooper: 'We don't want to get ".println("Trooper: 'We don't want to get ".println("Trooper: 'We don't want to get ".println("Trooper: 'We don't want to get ".println("Trooper: 'We don't want to get ".println("Trooper: 'We don't want to get " + "them mixed up so we ask you to give us" + "them mixed up so we ask you to give us" + "them mixed up so we ask you to give us" + "them mixed up so we ask you to give us" + "them mixed up so we ask you to give us" + "them mixed up so we ask you to give us" + "the radius of the deathstar, and the col" + "the radius of the deathstar, and the col" + "the radius of the deathstar, and the col" + "the radius of the deathstar, and the col" + "the radius of the deathstar, and the col" + "the radius of the deathstar, and the col" + "or.'"); + "or.'"); + "or.'"); + "or.'"); + "or.'"); + "or.'"); + "or.'"); + "or.'"); circleColor. circleColor. circleColor.circlecolorKing();();(); System. System. System.out.println("Trooper: 'hm yes good, ok you ".println("Trooper: 'hm yes good, ok you ".println("Trooper: 'hm yes good, ok you ".println("Trooper: 'hm yes good, ok you ".println("Trooper: 'hm yes good, ok you ".println("Trooper: 'hm yes good, ok you " + "may go.'"); + "may go.'"); + "may go.'"); + "may go.'"); + "may go.'"); + "may go.'"); + "may go.'"); + "may go.'"); scan++;// kill loop scan++;// kill loop scan++;// kill loop scan++;// kill loop scan++;// kill loop } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number"); } } } } break; break; break; case 2: case 2: case 2: case 2: case 2: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { System. System. System.out.println("You enter the room and everyone".println("You enter the room and everyone".println("You enter the room and everyone".println("You enter the room and everyone".println("You enter the room and everyone".println("You enter the room and everyone" + "is standing very worried in a line as lo" + "is standing very worried in a line as lo" + "is standing very worried in a line as lo" + "is standing very worried in a line as lo" + "is standing very worried in a line as lo" + "is standing very worried in a line as lo" + "rd vader was signing their books."); + "rd vader was signing their books."); + "rd vader was signing their books."); + "rd vader was signing their books."); + "rd vader was signing their books."); + "rd vader was signing their books."); + "rd vader was signing their books."); + "rd vader was signing their books."); System. System. System.out.println("You stand in line till you get ".println("You stand in line till you get ".println("You stand in line till you get ".println("You stand in line till you get ".println("You stand in line till you get ".println("You stand in line till you get " + "to the front"); + "to the front"); + "to the front"); + "to the front"); + "to the front"); + "to the front"); + "to the front"); + "to the front"); nameBookMail. nameBookMail. nameBookMail.nameBookMailKing();();(); System. System. System.out.println("Vader: 'You should check out my".println("Vader: 'You should check out my".println("Vader: 'You should check out my".println("Vader: 'You should check out my".println("Vader: 'You should check out my".println("Vader: 'You should check out my" + " new book 'fear and trembling.'"); + " new book 'fear and trembling.'"); + " new book 'fear and trembling.'"); + " new book 'fear and trembling.'"); + " new book 'fear and trembling.'"); + " new book 'fear and trembling.'"); + " new book 'fear and trembling.'"); + " new book 'fear and trembling.'"); System. System. System.out.println("He hands you a book titled fear".println("He hands you a book titled fear".println("He hands you a book titled fear".println("He hands you a book titled fear".println("He hands you a book titled fear".println("He hands you a book titled fear" + " and trembling. At the bottom where it s" + " and trembling. At the bottom where it s" + " and trembling. At the bottom where it s" + " and trembling. At the bottom where it s" + " and trembling. At the bottom where it s" + " and trembling. At the bottom where it s" + "ays who the author is, the name Johannes" + "ays who the author is, the name Johannes" + "ays who the author is, the name Johannes" + "ays who the author is, the name Johannes" + "ays who the author is, the name Johannes" + "ays who the author is, the name Johannes" + " de silentio is crossed out, and Anakin " + " de silentio is crossed out, and Anakin " + " de silentio is crossed out, and Anakin " + " de silentio is crossed out, and Anakin " + " de silentio is crossed out, and Anakin " + " de silentio is crossed out, and Anakin " + "skywalker is written in sharpie."); + "skywalker is written in sharpie."); + "skywalker is written in sharpie."); + "skywalker is written in sharpie."); + "skywalker is written in sharpie."); + "skywalker is written in sharpie."); + "skywalker is written in sharpie."); + "skywalker is written in sharpie."); System. System. System.out.println("You ask him if he actually wrot".println("You ask him if he actually wrot".println("You ask him if he actually wrot".println("You ask him if he actually wrot".println("You ask him if he actually wrot".println("You ask him if he actually wrot"

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/classes.java

1.1 of 2 2014.12.03 14:40:41

Page 21: Text adventure

737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111

System. System. System.out.println("You ask him if he actually wrot".println("You ask him if he actually wrot".println("You ask him if he actually wrot".println("You ask him if he actually wrot".println("You ask him if he actually wrot".println("You ask him if he actually wrot" + "e the book"); + "e the book"); + "e the book"); + "e the book"); + "e the book"); + "e the book"); + "e the book"); + "e the book"); System. System. System.out.println("Vader: 'Do you lack faith in me".println("Vader: 'Do you lack faith in me".println("Vader: 'Do you lack faith in me".println("Vader: 'Do you lack faith in me".println("Vader: 'Do you lack faith in me".println("Vader: 'Do you lack faith in me" + "?'"); + "?'"); + "?'"); + "?'"); + "?'"); + "?'"); + "?'"); + "?'"); System. System. System.out.println("he asks as he raises his hand.".println("he asks as he raises his hand.".println("he asks as he raises his hand.".println("he asks as he raises his hand.".println("he asks as he raises his hand.".println("he asks as he raises his hand." + ""); + ""); + ""); + ""); + ""); + ""); System. System. System.out.println("You run out of the room");.println("You run out of the room");.println("You run out of the room");.println("You run out of the room");.println("You run out of the room");.println("You run out of the room");.println("You run out of the room");.println("You run out of the room"); scan++; // kill loop scan++; // kill loop scan++; // kill loop scan++; // kill loop scan++; // kill loop scan++; // kill loop } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number"); } } } } break; break; break; case 3: case 3: case 3: case 3: case 3: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { System. System. System.out.println("You walk into the room and you ".println("You walk into the room and you ".println("You walk into the room and you ".println("You walk into the room and you ".println("You walk into the room and you ".println("You walk into the room and you " + "see a lot of computers everywhere. A sol" + "see a lot of computers everywhere. A sol" + "see a lot of computers everywhere. A sol" + "see a lot of computers everywhere. A sol" + "see a lot of computers everywhere. A sol" + "see a lot of computers everywhere. A sol" + "dier greets you."); + "dier greets you."); + "dier greets you."); + "dier greets you."); + "dier greets you."); + "dier greets you."); + "dier greets you."); + "dier greets you."); System. System. System.out.println("Soldier: 'I don't have time to ".println("Soldier: 'I don't have time to ".println("Soldier: 'I don't have time to ".println("Soldier: 'I don't have time to ".println("Soldier: 'I don't have time to ".println("Soldier: 'I don't have time to " + "explain how this works, follow my instru" + "explain how this works, follow my instru" + "explain how this works, follow my instru" + "explain how this works, follow my instru" + "explain how this works, follow my instru" + "explain how this works, follow my instru" + "ctions and we will see if it's operating" + "ctions and we will see if it's operating" + "ctions and we will see if it's operating" + "ctions and we will see if it's operating" + "ctions and we will see if it's operating" + "ctions and we will see if it's operating" + " appropriately.'"); + " appropriately.'"); + " appropriately.'"); + " appropriately.'"); + " appropriately.'"); + " appropriately.'"); + " appropriately.'"); + " appropriately.'"); xAndY. xAndY. xAndY.xAndYKing();();(); System. System. System.out.println("Soldier: I hope this is right,".println("Soldier: I hope this is right,".println("Soldier: I hope this is right,".println("Soldier: I hope this is right,".println("Soldier: I hope this is right,".println("Soldier: I hope this is right," + " move along."); + " move along."); + " move along."); + " move along."); + " move along."); + " move along."); + " move along."); + " move along."); scan++; // kill loop scan++; // kill loop scan++; // kill loop scan++; // kill loop scan++; // kill loop scan++; // kill loop } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number"); } } } } break; break; break; } }

} }

} }}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/classes.java

2.1 of 2 2014.12.03 14:40:41

Page 22: Text adventure

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class collections { {

public static void public static void public static void public static void public static void public static void public static void collectionsKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in); ); ); int scan, collect = 0; int scan, collect = 0; int scan, collect = 0; int scan, collect = 0; int scan, collect = 0; int scan, collect = 0; int scan, collect = 0; int scan, collect = 0; int scan, collect = 0; int scan, collect = 0; int scan, collect = 0; int scan, collect = 0; System. System. System.out.println("You walk up to the collections office.");.println("You walk up to the collections office.");.println("You walk up to the collections office.");.println("You walk up to the collections office.");.println("You walk up to the collections office.");.println("You walk up to the collections office.");.println("You walk up to the collections office.");.println("You walk up to the collections office."); System. System. System.out.println("Man: 'We're very busy what do you want!'");.println("Man: 'We're very busy what do you want!'");.println("Man: 'We're very busy what do you want!'");.println("Man: 'We're very busy what do you want!'");.println("Man: 'We're very busy what do you want!'");.println("Man: 'We're very busy what do you want!'");.println("Man: 'We're very busy what do you want!'");.println("Man: 'We're very busy what do you want!'"); System. System. System.out.println("Man: 'Oh, your here to pay a debt. I'll make you a ".println("Man: 'Oh, your here to pay a debt. I'll make you a ".println("Man: 'Oh, your here to pay a debt. I'll make you a ".println("Man: 'Oh, your here to pay a debt. I'll make you a ".println("Man: 'Oh, your here to pay a debt. I'll make you a ".println("Man: 'Oh, your here to pay a debt. I'll make you a " + "deal.'"); + "deal.'"); + "deal.'"); + "deal.'"); + "deal.'"); + "deal.'"); + "deal.'"); + "deal.'"); System. System. System.out.println("Man: 'Help us with some paper work and we won't mak".println("Man: 'Help us with some paper work and we won't mak".println("Man: 'Help us with some paper work and we won't mak".println("Man: 'Help us with some paper work and we won't mak".println("Man: 'Help us with some paper work and we won't mak".println("Man: 'Help us with some paper work and we won't mak" + "e you pay back your debt.!"); + "e you pay back your debt.!"); + "e you pay back your debt.!"); + "e you pay back your debt.!"); + "e you pay back your debt.!"); + "e you pay back your debt.!"); + "e you pay back your debt.!"); + "e you pay back your debt.!"); System. System. System.out.println("you can go to the counting office");.println("you can go to the counting office");.println("you can go to the counting office");.println("you can go to the counting office");.println("you can go to the counting office");.println("you can go to the counting office");.println("you can go to the counting office");.println("you can go to the counting office"); System. System. System.out.println("the counting office but slightly better");.println("the counting office but slightly better");.println("the counting office but slightly better");.println("the counting office but slightly better");.println("the counting office but slightly better");.println("the counting office but slightly better");.println("the counting office but slightly better");.println("the counting office but slightly better"); System. System. System.out.println("Or the third counting office.");.println("Or the third counting office.");.println("Or the third counting office.");.println("Or the third counting office.");.println("Or the third counting office.");.println("Or the third counting office.");.println("Or the third counting office.");.println("Or the third counting office."); while (collect != 4) { while (collect != 4) { while (collect != 4) { while (collect != 4) { while (collect != 4) { while (collect != 4) { while (collect != 4) { while (collect != 4) { while (collect != 4) { while (collect != 4) { while (collect != 4) { while (collect != 4) { scan = 0; // reset scan at the beginning of every loop scan = 0; // reset scan at the beginning of every loop scan = 0; // reset scan at the beginning of every loop scan = 0; // reset scan at the beginning of every loop scan = 0; // reset scan at the beginning of every loop scan = 0; // reset scan at the beginning of every loop scan = 0; // reset scan at the beginning of every loop scan = 0; // reset scan at the beginning of every loop scan = 0; // reset scan at the beginning of every loop System. System. System.out.println("Choose 1:counting office 1, 2: counting office ".println("Choose 1:counting office 1, 2: counting office ".println("Choose 1:counting office 1, 2: counting office ".println("Choose 1:counting office 1, 2: counting office ".println("Choose 1:counting office 1, 2: counting office ".println("Choose 1:counting office 1, 2: counting office " + "2, 3: counting office 3, 4: leave."); + "2, 3: counting office 3, 4: leave."); + "2, 3: counting office 3, 4: leave."); + "2, 3: counting office 3, 4: leave."); + "2, 3: counting office 3, 4: leave."); + "2, 3: counting office 3, 4: leave."); + "2, 3: counting office 3, 4: leave."); + "2, 3: counting office 3, 4: leave."); collect = in.nextInt(); collect = in.nextInt(); collect = in.nextInt(); collect = in.nextInt(); collect = in.nextInt(); collect = in.nextInt(); collect = in.nextInt(); collect = in.nextInt(); collect = in.nextInt(); collect = in.nextInt(); collect = in.nextInt(); switch (collect) { switch (collect) { switch (collect) { switch (collect) { switch (collect) { switch (collect) { switch (collect) { switch (collect) { case 1: case 1: case 1: case 1: case 1: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { System. System. System.out.println("Man: Welcome to counting office".println("Man: Welcome to counting office".println("Man: Welcome to counting office".println("Man: Welcome to counting office".println("Man: Welcome to counting office".println("Man: Welcome to counting office" + " 1."); + " 1."); + " 1."); + " 1."); + " 1."); + " 1."); + " 1."); + " 1."); System. System. System.out.println("Man: Give me a series of number".println("Man: Give me a series of number".println("Man: Give me a series of number".println("Man: Give me a series of number".println("Man: Give me a series of number".println("Man: Give me a series of number" + "s so I can pick out the largest number"); + "s so I can pick out the largest number"); + "s so I can pick out the largest number"); + "s so I can pick out the largest number"); + "s so I can pick out the largest number"); + "s so I can pick out the largest number"); + "s so I can pick out the largest number"); + "s so I can pick out the largest number"); largestArray. largestArray. largestArray.largestArrayKing();();(); System. System. System.out.println("Man: You may go now.");.println("Man: You may go now.");.println("Man: You may go now.");.println("Man: You may go now.");.println("Man: You may go now.");.println("Man: You may go now.");.println("Man: You may go now.");.println("Man: You may go now."); scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers");

} } } } break; break; break; case 2: case 2: case 2: case 2: case 2: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { System. System. System.out.println("Man: Hello, welcome to the coun".println("Man: Hello, welcome to the coun".println("Man: Hello, welcome to the coun".println("Man: Hello, welcome to the coun".println("Man: Hello, welcome to the coun".println("Man: Hello, welcome to the coun" + "ting office 2."); + "ting office 2."); + "ting office 2."); + "ting office 2."); + "ting office 2."); + "ting office 2."); + "ting office 2."); + "ting office 2."); System. System. System.out.println("Man: Give me a series of words ".println("Man: Give me a series of words ".println("Man: Give me a series of words ".println("Man: Give me a series of words ".println("Man: Give me a series of words ".println("Man: Give me a series of words " + "and I will pick the largest word."); + "and I will pick the largest word."); + "and I will pick the largest word."); + "and I will pick the largest word."); + "and I will pick the largest word."); + "and I will pick the largest word."); + "and I will pick the largest word."); + "and I will pick the largest word."); longestString. longestString. longestString.longestStringKing();();(); System. System. System.out.println("Man: You may go now.");.println("Man: You may go now.");.println("Man: You may go now.");.println("Man: You may go now.");.println("Man: You may go now.");.println("Man: You may go now.");.println("Man: You may go now.");.println("Man: You may go now."); scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter words");.println("Please enter words");.println("Please enter words");.println("Please enter words");.println("Please enter words");.println("Please enter words");.println("Please enter words");.println("Please enter words"); } } } } break; break; break; case 3: case 3: case 3: case 3: case 3: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { System. System. System.out.println("Man: Welcomg to counting office".println("Man: Welcomg to counting office".println("Man: Welcomg to counting office".println("Man: Welcomg to counting office".println("Man: Welcomg to counting office".println("Man: Welcomg to counting office" + "3."); + "3."); + "3."); + "3."); + "3."); + "3."); + "3."); + "3."); System. System. System.out.println("Give me a series of numbers and".println("Give me a series of numbers and".println("Give me a series of numbers and".println("Give me a series of numbers and".println("Give me a series of numbers and".println("Give me a series of numbers and" + " i will tell you the largest number and " + " i will tell you the largest number and " + " i will tell you the largest number and " + " i will tell you the largest number and " + " i will tell you the largest number and " + " i will tell you the largest number and "

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/collections.java

1.1 of 2 2014.12.03 14:22:41

Page 23: Text adventure

737475767778798081828384858687888990

+ " i will tell you the largest number and " + " i will tell you the largest number and " + " i will tell you the largest number and " + " i will tell you the largest number and " + " i will tell you the largest number and " + " i will tell you the largest number and " + "where it appeared in your list."); + "where it appeared in your list."); + "where it appeared in your list."); + "where it appeared in your list."); + "where it appeared in your list."); + "where it appeared in your list."); + "where it appeared in your list."); + "where it appeared in your list."); longestArrayPosition. longestArrayPosition. longestArrayPosition.longestArrayPositionKing();();(); System. System. System.out.println("Man: You may go now.");.println("Man: You may go now.");.println("Man: You may go now.");.println("Man: You may go now.");.println("Man: You may go now.");.println("Man: You may go now.");.println("Man: You may go now.");.println("Man: You may go now."); scan++;//kills loop scan++;//kills loop scan++;//kills loop scan++;//kills loop scan++;//kills loop } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers"); } } } } break; break; break; } }

} }

} }

}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/collections.java

2.1 of 2 2014.12.03 14:22:41

Page 24: Text adventure

1234567891011121314151617181920212223242526272829303132

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class countingNumbers { {

public static void public static void public static void public static void public static void public static void public static void countingNumbersKing() {() {() {() { int number; int number; int number; int number; int number; Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in); ); ); System. System. System.out.println("What number do you give him?");.println("What number do you give him?");.println("What number do you give him?");.println("What number do you give him?");.println("What number do you give him?");.println("What number do you give him?");.println("What number do you give him?");.println("What number do you give him?"); number = in.nextInt(); number = in.nextInt(); number = in.nextInt(); number = in.nextInt(); number = in.nextInt(); number = in.nextInt(); number = in.nextInt(); number = in.nextInt(); number = in.nextInt(); number = in.nextInt(); number = in.nextInt(); System. System. System.out.print("Clown: ");.print("Clown: ");.print("Clown: ");.print("Clown: ");.print("Clown: ");.print("Clown: ");.print("Clown: ");.print("Clown: "); for (int x = 0; x <= number; x++) { // counts up for (int x = 0; x <= number; x++) { // counts up for (int x = 0; x <= number; x++) { // counts up for (int x = 0; x <= number; x++) { // counts up for (int x = 0; x <= number; x++) { // counts up for (int x = 0; x <= number; x++) { // counts up for (int x = 0; x <= number; x++) { // counts up for (int x = 0; x <= number; x++) { // counts up for (int x = 0; x <= number; x++) { // counts up for (int x = 0; x <= number; x++) { // counts up for (int x = 0; x <= number; x++) { // counts up for (int x = 0; x <= number; x++) { // counts up for (int x = 0; x <= number; x++) { // counts up for (int x = 0; x <= number; x++) { // counts up for (int x = 0; x <= number; x++) { // counts up for (int x = 0; x <= number; x++) { // counts up for (int x = 0; x <= number; x++) { // counts up for (int x = 0; x <= number; x++) { // counts up for (int x = 0; x <= number; x++) { // counts up for (int x = 0; x <= number; x++) { // counts up for (int x = 0; x <= number; x++) { // counts up for (int x = 0; x <= number; x++) { // counts up for (int x = 0; x <= number; x++) { // counts up for (int x = 0; x <= number; x++) { // counts up for (int x = 0; x <= number; x++) { // counts up for (int x = 0; x <= number; x++) { // counts up for (int x = 0; x <= number; x++) { // counts up System. System. System.out.println(x);.println(x);.println(x);.println(x);.println(x);.println(x);

} }

} }

}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/countingNumbers.java

1.1 of 1 2014.12.03 14:58:46

Page 25: Text adventure

12345678910111213141516171819202122232425262728293031

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner; import java.util.Scanner; import java.util.Scanner; import java.util.Scanner; import java.util.Scanner; import java.util.Scanner; import java.util.Scanner; import java.util.Scanner; import java.util.Scanner;

public class public class public class public class cToF { {

public static void public static void public static void public static void public static void public static void public static void cToFKing() {() {() {() { System. System. System.out.println("What temperature do you tell her?");.println("What temperature do you tell her?");.println("What temperature do you tell her?");.println("What temperature do you tell her?");.println("What temperature do you tell her?");.println("What temperature do you tell her?");.println("What temperature do you tell her?");.println("What temperature do you tell her?"); Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in););

double Celcius = in.nextDouble(); double Celcius = in.nextDouble(); double Celcius = in.nextDouble(); double Celcius = in.nextDouble(); double Celcius = in.nextDouble(); double Celcius = in.nextDouble(); double Celcius = in.nextDouble(); double Celcius = in.nextDouble(); double Celcius = in.nextDouble(); double Celcius = in.nextDouble(); double Celcius = in.nextDouble(); double Celcius = in.nextDouble(); double Celcius = in.nextDouble(); double Fahrenheit; double Fahrenheit; double Fahrenheit; double Fahrenheit; double Fahrenheit; Fahrenheit = (Celcius * 9) / 5 + 32; // equation from C to F Fahrenheit = (Celcius * 9) / 5 + 32; // equation from C to F Fahrenheit = (Celcius * 9) / 5 + 32; // equation from C to F Fahrenheit = (Celcius * 9) / 5 + 32; // equation from C to F Fahrenheit = (Celcius * 9) / 5 + 32; // equation from C to F Fahrenheit = (Celcius * 9) / 5 + 32; // equation from C to F Fahrenheit = (Celcius * 9) / 5 + 32; // equation from C to F Fahrenheit = (Celcius * 9) / 5 + 32; // equation from C to F Fahrenheit = (Celcius * 9) / 5 + 32; // equation from C to F Fahrenheit = (Celcius * 9) / 5 + 32; // equation from C to F Fahrenheit = (Celcius * 9) / 5 + 32; // equation from C to F Fahrenheit = (Celcius * 9) / 5 + 32; // equation from C to F Fahrenheit = (Celcius * 9) / 5 + 32; // equation from C to F Fahrenheit = (Celcius * 9) / 5 + 32; // equation from C to F Fahrenheit = (Celcius * 9) / 5 + 32; // equation from C to F Fahrenheit = (Celcius * 9) / 5 + 32; // equation from C to F Fahrenheit = (Celcius * 9) / 5 + 32; // equation from C to F Fahrenheit = (Celcius * 9) / 5 + 32; // equation from C to F Fahrenheit = (Celcius * 9) / 5 + 32; // equation from C to F Fahrenheit = (Celcius * 9) / 5 + 32; // equation from C to F Fahrenheit = (Celcius * 9) / 5 + 32; // equation from C to F Fahrenheit = (Celcius * 9) / 5 + 32; // equation from C to F Fahrenheit = (Celcius * 9) / 5 + 32; // equation from C to F

System. System. System.out.print("Storm: 'The temperature is now " + Fahrenheit);.print("Storm: 'The temperature is now " + Fahrenheit);.print("Storm: 'The temperature is now " + Fahrenheit);.print("Storm: 'The temperature is now " + Fahrenheit);.print("Storm: 'The temperature is now " + Fahrenheit);.print("Storm: 'The temperature is now " + Fahrenheit);.print("Storm: 'The temperature is now " + Fahrenheit);.print("Storm: 'The temperature is now " + Fahrenheit);.print("Storm: 'The temperature is now " + Fahrenheit);.print("Storm: 'The temperature is now " + Fahrenheit);.print("Storm: 'The temperature is now " + Fahrenheit);.print("Storm: 'The temperature is now " + Fahrenheit); System. System. System.out.println(" degrees Fahrenheit.'");.println(" degrees Fahrenheit.'");.println(" degrees Fahrenheit.'");.println(" degrees Fahrenheit.'");.println(" degrees Fahrenheit.'");.println(" degrees Fahrenheit.'");.println(" degrees Fahrenheit.'");.println(" degrees Fahrenheit.'"); } }

}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/cToF.java

1.1 of 1 2014.12.03 15:16:10

Page 26: Text adventure

12345678910111213141516171819202122232425262728293031323334353637383940

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class declareVariable { {

public static void public static void public static void public static void public static void public static void public static void declareVariableKing() {() {() {() { caculateValues();();(); } }

static void static void static void static void static void caculateValues() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in);); System. System. System.out.print("Enter a number:");.print("Enter a number:");.print("Enter a number:");.print("Enter a number:");.print("Enter a number:");.print("Enter a number:");.print("Enter a number:");.print("Enter a number:"); int a = in.nextInt(); int a = in.nextInt(); int a = in.nextInt(); int a = in.nextInt(); int a = in.nextInt(); int a = in.nextInt(); int a = in.nextInt(); int a = in.nextInt(); int a = in.nextInt(); int a = in.nextInt(); int a = in.nextInt(); int a = in.nextInt(); int a = in.nextInt(); System. System. System.out.print("Enter another number:");.print("Enter another number:");.print("Enter another number:");.print("Enter another number:");.print("Enter another number:");.print("Enter another number:");.print("Enter another number:");.print("Enter another number:"); int b = in.nextInt(); int b = in.nextInt(); int b = in.nextInt(); int b = in.nextInt(); int b = in.nextInt(); int b = in.nextInt(); int b = in.nextInt(); int b = in.nextInt(); int b = in.nextInt(); int b = in.nextInt(); int b = in.nextInt(); int b = in.nextInt(); int b = in.nextInt(); // This does the actual work // This does the actual work int resultA = a + b; int resultA = a + b; int resultA = a + b; int resultA = a + b; int resultA = a + b; int resultA = a + b; int resultA = a + b; int resultA = a + b; int resultA = a + b; int resultA = a + b; int resultA = a + b; int resultA = a + b; int resultA = a + b; int resultS = a - b; int resultS = a - b; int resultS = a - b; int resultS = a - b; int resultS = a - b; int resultS = a - b; int resultS = a - b; int resultS = a - b; int resultS = a - b; int resultS = a - b; int resultS = a - b; int resultS = a - b; int resultS = a - b; int resultM = a * b; int resultM = a * b; int resultM = a * b; int resultM = a * b; int resultM = a * b; int resultM = a * b; int resultM = a * b; int resultM = a * b; int resultM = a * b; int resultM = a * b; int resultM = a * b; int resultM = a * b; int resultM = a * b; double resultD = a / b; double resultD = a / b; double resultD = a / b; double resultD = a / b; double resultD = a / b; double resultD = a / b; double resultD = a / b; double resultD = a / b; double resultD = a / b; double resultD = a / b; double resultD = a / b; double resultD = a / b; double resultD = a / b; System. System. System.out.println("The result of adding is " + resultA);.println("The result of adding is " + resultA);.println("The result of adding is " + resultA);.println("The result of adding is " + resultA);.println("The result of adding is " + resultA);.println("The result of adding is " + resultA);.println("The result of adding is " + resultA);.println("The result of adding is " + resultA);.println("The result of adding is " + resultA);.println("The result of adding is " + resultA);.println("The result of adding is " + resultA);.println("The result of adding is " + resultA); System. System. System.out.println("The result of subtracting is " + resultS);.println("The result of subtracting is " + resultS);.println("The result of subtracting is " + resultS);.println("The result of subtracting is " + resultS);.println("The result of subtracting is " + resultS);.println("The result of subtracting is " + resultS);.println("The result of subtracting is " + resultS);.println("The result of subtracting is " + resultS);.println("The result of subtracting is " + resultS);.println("The result of subtracting is " + resultS);.println("The result of subtracting is " + resultS);.println("The result of subtracting is " + resultS); System. System. System.out.println("The result of multiplying is " + resultM);.println("The result of multiplying is " + resultM);.println("The result of multiplying is " + resultM);.println("The result of multiplying is " + resultM);.println("The result of multiplying is " + resultM);.println("The result of multiplying is " + resultM);.println("The result of multiplying is " + resultM);.println("The result of multiplying is " + resultM);.println("The result of multiplying is " + resultM);.println("The result of multiplying is " + resultM);.println("The result of multiplying is " + resultM);.println("The result of multiplying is " + resultM); System. System. System.out.println("The result of dividing is " + resultD);.println("The result of dividing is " + resultD);.println("The result of dividing is " + resultD);.println("The result of dividing is " + resultD);.println("The result of dividing is " + resultD);.println("The result of dividing is " + resultD);.println("The result of dividing is " + resultD);.println("The result of dividing is " + resultD);.println("The result of dividing is " + resultD);.println("The result of dividing is " + resultD);.println("The result of dividing is " + resultD);.println("The result of dividing is " + resultD); } }

}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/declareVariable.java

1.1 of 1 2014.12.03 13:29:19

Page 27: Text adventure

1234567891011121314151617181920212223242526272829303132333435

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class dynamicAdding { {

public static void public static void public static void public static void public static void public static void public static void dynamicAddingKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in); ); );

int sum = 0, number, addingv; int sum = 0, number, addingv; int sum = 0, number, addingv; int sum = 0, number, addingv; int sum = 0, number, addingv; int sum = 0, number, addingv; int sum = 0, number, addingv; int sum = 0, number, addingv; int sum = 0, number, addingv; int sum = 0, number, addingv; int sum = 0, number, addingv; int sum = 0, number, addingv; int sum = 0, number, addingv; int sum = 0, number, addingv; int sum = 0, number, addingv; System. System. System.out.println("Man: 'How many numbers would you like to add?'");.println("Man: 'How many numbers would you like to add?'");.println("Man: 'How many numbers would you like to add?'");.println("Man: 'How many numbers would you like to add?'");.println("Man: 'How many numbers would you like to add?'");.println("Man: 'How many numbers would you like to add?'");.println("Man: 'How many numbers would you like to add?'");.println("Man: 'How many numbers would you like to add?'"); number = in.nextInt(); number = in.nextInt(); number = in.nextInt(); number = in.nextInt(); number = in.nextInt(); number = in.nextInt(); number = in.nextInt(); number = in.nextInt(); number = in.nextInt(); number = in.nextInt(); number = in.nextInt();

System. System. System.out.println("Man: 'G-good, give me " + number + " numbers to add".println("Man: 'G-good, give me " + number + " numbers to add".println("Man: 'G-good, give me " + number + " numbers to add".println("Man: 'G-good, give me " + number + " numbers to add".println("Man: 'G-good, give me " + number + " numbers to add".println("Man: 'G-good, give me " + number + " numbers to add".println("Man: 'G-good, give me " + number + " numbers to add".println("Man: 'G-good, give me " + number + " numbers to add".println("Man: 'G-good, give me " + number + " numbers to add".println("Man: 'G-good, give me " + number + " numbers to add".println("Man: 'G-good, give me " + number + " numbers to add".println("Man: 'G-good, give me " + number + " numbers to add".println("Man: 'G-good, give me " + number + " numbers to add".println("Man: 'G-good, give me " + number + " numbers to add".println("Man: 'G-good, give me " + number + " numbers to add".println("Man: 'G-good, give me " + number + " numbers to add" + ".'"); + ".'"); + ".'"); + ".'"); + ".'"); + ".'"); + ".'"); + ".'"); + ".'"); for (int loopcontrol = 1; loopcontrol <= number; loopcontrol++) { for (int loopcontrol = 1; loopcontrol <= number; loopcontrol++) { for (int loopcontrol = 1; loopcontrol <= number; loopcontrol++) { for (int loopcontrol = 1; loopcontrol <= number; loopcontrol++) { for (int loopcontrol = 1; loopcontrol <= number; loopcontrol++) { for (int loopcontrol = 1; loopcontrol <= number; loopcontrol++) { for (int loopcontrol = 1; loopcontrol <= number; loopcontrol++) { for (int loopcontrol = 1; loopcontrol <= number; loopcontrol++) { for (int loopcontrol = 1; loopcontrol <= number; loopcontrol++) { for (int loopcontrol = 1; loopcontrol <= number; loopcontrol++) { for (int loopcontrol = 1; loopcontrol <= number; loopcontrol++) { for (int loopcontrol = 1; loopcontrol <= number; loopcontrol++) { for (int loopcontrol = 1; loopcontrol <= number; loopcontrol++) { for (int loopcontrol = 1; loopcontrol <= number; loopcontrol++) { for (int loopcontrol = 1; loopcontrol <= number; loopcontrol++) { for (int loopcontrol = 1; loopcontrol <= number; loopcontrol++) { for (int loopcontrol = 1; loopcontrol <= number; loopcontrol++) { for (int loopcontrol = 1; loopcontrol <= number; loopcontrol++) { for (int loopcontrol = 1; loopcontrol <= number; loopcontrol++) { for (int loopcontrol = 1; loopcontrol <= number; loopcontrol++) { for (int loopcontrol = 1; loopcontrol <= number; loopcontrol++) { for (int loopcontrol = 1; loopcontrol <= number; loopcontrol++) { for (int loopcontrol = 1; loopcontrol <= number; loopcontrol++) { for (int loopcontrol = 1; loopcontrol <= number; loopcontrol++) { for (int loopcontrol = 1; loopcontrol <= number; loopcontrol++) { addingv = in.nextInt(); //adds all numbers given together addingv = in.nextInt(); //adds all numbers given together addingv = in.nextInt(); //adds all numbers given together addingv = in.nextInt(); //adds all numbers given together addingv = in.nextInt(); //adds all numbers given together addingv = in.nextInt(); //adds all numbers given together addingv = in.nextInt(); //adds all numbers given together addingv = in.nextInt(); //adds all numbers given together addingv = in.nextInt(); //adds all numbers given together addingv = in.nextInt(); //adds all numbers given together addingv = in.nextInt(); //adds all numbers given together addingv = in.nextInt(); //adds all numbers given together addingv = in.nextInt(); //adds all numbers given together sum = sum + addingv; sum = sum + addingv; sum = sum + addingv; sum = sum + addingv; sum = sum + addingv; sum = sum + addingv; sum = sum + addingv; sum = sum + addingv; sum = sum + addingv; sum = sum + addingv; sum = sum + addingv; } } System. System. System.out.println("Man: 'The sum is " + sum + "'");.println("Man: 'The sum is " + sum + "'");.println("Man: 'The sum is " + sum + "'");.println("Man: 'The sum is " + sum + "'");.println("Man: 'The sum is " + sum + "'");.println("Man: 'The sum is " + sum + "'");.println("Man: 'The sum is " + sum + "'");.println("Man: 'The sum is " + sum + "'");.println("Man: 'The sum is " + sum + "'");.println("Man: 'The sum is " + sum + "'");.println("Man: 'The sum is " + sum + "'");.println("Man: 'The sum is " + sum + "'");.println("Man: 'The sum is " + sum + "'");.println("Man: 'The sum is " + sum + "'");.println("Man: 'The sum is " + sum + "'");.println("Man: 'The sum is " + sum + "'");.println("Man: 'The sum is " + sum + "'");.println("Man: 'The sum is " + sum + "'");

} }}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/dynamicAdding.java

1.1 of 1 2014.12.03 14:58:03

Page 28: Text adventure

123456789101112131415161718192021222324252627282930313233343536373839404142434445

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class evenOnly { {

public static void public static void public static void public static void public static void public static void public static void evenOnlyKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in);); int[] arr = new int[5]; int[] arr = new int[5]; int[] arr = new int[5]; int[] arr = new int[5]; int[] arr = new int[5]; int[] arr = new int[5]; int[] arr = new int[5]; int[] arr = new int[5]; int[] arr = new int[5]; int[] arr = new int[5]; int[] arr = new int[5]; int[] arr = new int[5]; int[] arr = new int[5]; int[] arr = new int[5]; int[] arr = new int[5]; int[] arr = new int[5]; int zero = 0; int zero = 0; int zero = 0; int zero = 0; int zero = 0; int zero = 0; int zero = 0; int zero = 0; int zero = 0; System. System. System.out.println("Jones: 'Just give me a few numbers boy, only 5 numb".println("Jones: 'Just give me a few numbers boy, only 5 numb".println("Jones: 'Just give me a few numbers boy, only 5 numb".println("Jones: 'Just give me a few numbers boy, only 5 numb".println("Jones: 'Just give me a few numbers boy, only 5 numb".println("Jones: 'Just give me a few numbers boy, only 5 numb" + "ers."); + "ers."); + "ers."); + "ers."); + "ers."); + "ers."); + "ers."); + "ers."); System. System. System.out.println("Which numbers do you enter?");.println("Which numbers do you enter?");.println("Which numbers do you enter?");.println("Which numbers do you enter?");.println("Which numbers do you enter?");.println("Which numbers do you enter?");.println("Which numbers do you enter?");.println("Which numbers do you enter?"); for (int arrlang = 0; arrlang < arr.length; arrlang++) { for (int arrlang = 0; arrlang < arr.length; arrlang++) { for (int arrlang = 0; arrlang < arr.length; arrlang++) { for (int arrlang = 0; arrlang < arr.length; arrlang++) { for (int arrlang = 0; arrlang < arr.length; arrlang++) { for (int arrlang = 0; arrlang < arr.length; arrlang++) { for (int arrlang = 0; arrlang < arr.length; arrlang++) { for (int arrlang = 0; arrlang < arr.length; arrlang++) { for (int arrlang = 0; arrlang < arr.length; arrlang++) { for (int arrlang = 0; arrlang < arr.length; arrlang++) { for (int arrlang = 0; arrlang < arr.length; arrlang++) { for (int arrlang = 0; arrlang < arr.length; arrlang++) { for (int arrlang = 0; arrlang < arr.length; arrlang++) { for (int arrlang = 0; arrlang < arr.length; arrlang++) { for (int arrlang = 0; arrlang < arr.length; arrlang++) { for (int arrlang = 0; arrlang < arr.length; arrlang++) { for (int arrlang = 0; arrlang < arr.length; arrlang++) { for (int arrlang = 0; arrlang < arr.length; arrlang++) { for (int arrlang = 0; arrlang < arr.length; arrlang++) { for (int arrlang = 0; arrlang < arr.length; arrlang++) { for (int arrlang = 0; arrlang < arr.length; arrlang++) { for (int arrlang = 0; arrlang < arr.length; arrlang++) { for (int arrlang = 0; arrlang < arr.length; arrlang++) { for (int arrlang = 0; arrlang < arr.length; arrlang++) { for (int arrlang = 0; arrlang < arr.length; arrlang++) { for (int arrlang = 0; arrlang < arr.length; arrlang++) { for (int arrlang = 0; arrlang < arr.length; arrlang++) { arr[arrlang] = in.nextInt(); arr[arrlang] = in.nextInt(); arr[arrlang] = in.nextInt(); arr[arrlang] = in.nextInt(); arr[arrlang] = in.nextInt(); arr[arrlang] = in.nextInt(); arr[arrlang] = in.nextInt(); arr[arrlang] = in.nextInt(); arr[arrlang] = in.nextInt(); arr[arrlang] = in.nextInt(); arr[arrlang] = in.nextInt(); arr[arrlang] = in.nextInt(); arr[arrlang] = in.nextInt(); arr[arrlang] = in.nextInt(); } } System. System. System.out.println("Jones: The even numbers you stated were: ");.println("Jones: The even numbers you stated were: ");.println("Jones: The even numbers you stated were: ");.println("Jones: The even numbers you stated were: ");.println("Jones: The even numbers you stated were: ");.println("Jones: The even numbers you stated were: ");.println("Jones: The even numbers you stated were: ");.println("Jones: The even numbers you stated were: "); for (int counter = 0; counter < arr.length; counter++) { for (int counter = 0; counter < arr.length; counter++) { for (int counter = 0; counter < arr.length; counter++) { for (int counter = 0; counter < arr.length; counter++) { for (int counter = 0; counter < arr.length; counter++) { for (int counter = 0; counter < arr.length; counter++) { for (int counter = 0; counter < arr.length; counter++) { for (int counter = 0; counter < arr.length; counter++) { for (int counter = 0; counter < arr.length; counter++) { for (int counter = 0; counter < arr.length; counter++) { for (int counter = 0; counter < arr.length; counter++) { for (int counter = 0; counter < arr.length; counter++) { for (int counter = 0; counter < arr.length; counter++) { for (int counter = 0; counter < arr.length; counter++) { for (int counter = 0; counter < arr.length; counter++) { for (int counter = 0; counter < arr.length; counter++) { for (int counter = 0; counter < arr.length; counter++) { for (int counter = 0; counter < arr.length; counter++) { for (int counter = 0; counter < arr.length; counter++) { for (int counter = 0; counter < arr.length; counter++) { for (int counter = 0; counter < arr.length; counter++) { for (int counter = 0; counter < arr.length; counter++) { for (int counter = 0; counter < arr.length; counter++) { for (int counter = 0; counter < arr.length; counter++) { for (int counter = 0; counter < arr.length; counter++) { for (int counter = 0; counter < arr.length; counter++) { for (int counter = 0; counter < arr.length; counter++) { if (arr[counter] % 2 == 0) { if (arr[counter] % 2 == 0) { if (arr[counter] % 2 == 0) { if (arr[counter] % 2 == 0) { if (arr[counter] % 2 == 0) { if (arr[counter] % 2 == 0) { if (arr[counter] % 2 == 0) { if (arr[counter] % 2 == 0) { if (arr[counter] % 2 == 0) { if (arr[counter] % 2 == 0) { if (arr[counter] % 2 == 0) { if (arr[counter] % 2 == 0) { if (arr[counter] % 2 == 0) { if (arr[counter] % 2 == 0) { if (arr[counter] % 2 == 0) { if (arr[counter] % 2 == 0) { if (arr[counter] % 2 == 0) { if (arr[counter] % 2 == 0) { if (arr[counter] % 2 == 0) { System. System. System.out.println(arr[counter]);.println(arr[counter]);.println(arr[counter]);.println(arr[counter]);.println(arr[counter]);.println(arr[counter]);.println(arr[counter]);.println(arr[counter]);.println(arr[counter]); } else { } else { } else { } else { } else { } else { zero++; zero++; zero++; zero++; } } } } if (zero == 5) { // if the program failed to find a number divisable by if (zero == 5) { // if the program failed to find a number divisable by if (zero == 5) { // if the program failed to find a number divisable by if (zero == 5) { // if the program failed to find a number divisable by if (zero == 5) { // if the program failed to find a number divisable by if (zero == 5) { // if the program failed to find a number divisable by if (zero == 5) { // if the program failed to find a number divisable by if (zero == 5) { // if the program failed to find a number divisable by if (zero == 5) { // if the program failed to find a number divisable by if (zero == 5) { // if the program failed to find a number divisable by if (zero == 5) { // if the program failed to find a number divisable by if (zero == 5) { // if the program failed to find a number divisable by if (zero == 5) { // if the program failed to find a number divisable by if (zero == 5) { // if the program failed to find a number divisable by //two in the array than zero = 5 //two in the array than zero = 5 System. System. System.out.println("Jones: 'Oh! None of the numbers you entered wer".println("Jones: 'Oh! None of the numbers you entered wer".println("Jones: 'Oh! None of the numbers you entered wer".println("Jones: 'Oh! None of the numbers you entered wer".println("Jones: 'Oh! None of the numbers you entered wer".println("Jones: 'Oh! None of the numbers you entered wer" + "e even, that is boring, get out.'"); + "e even, that is boring, get out.'"); + "e even, that is boring, get out.'"); + "e even, that is boring, get out.'"); + "e even, that is boring, get out.'"); + "e even, that is boring, get out.'"); + "e even, that is boring, get out.'"); + "e even, that is boring, get out.'"); } }

} }

}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/evenOnly.java

1.1 of 1 2014.12.03 14:31:14

Page 29: Text adventure

1234567891011121314151617181920212223242526272829303132

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class evenOrOdd { {

public static void public static void public static void public static void public static void public static void public static void evenOrOddKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in);); System. System. System.out.println("Enter a number:");.println("Enter a number:");.println("Enter a number:");.println("Enter a number:");.println("Enter a number:");.println("Enter a number:");.println("Enter a number:");.println("Enter a number:"); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int EVEN = 0; int EVEN = 0; int EVEN = 0; int EVEN = 0; int EVEN = 0; int EVEN = 0; int EVEN = 0; int EVEN = 0; int EVEN = 0; if (EVEN == num1 % 2) { if (EVEN == num1 % 2) { if (EVEN == num1 % 2) { if (EVEN == num1 % 2) { if (EVEN == num1 % 2) { if (EVEN == num1 % 2) { if (EVEN == num1 % 2) { if (EVEN == num1 % 2) { if (EVEN == num1 % 2) { if (EVEN == num1 % 2) { if (EVEN == num1 % 2) { if (EVEN == num1 % 2) { if (EVEN == num1 % 2) { if (EVEN == num1 % 2) { if (EVEN == num1 % 2) { if (EVEN == num1 % 2) {//need curley braces after if statment. Need to put () around operation. //need curley braces after if statment. Need to put () around operation. System. System. System.out.println("The number you entered was even");.println("The number you entered was even");.println("The number you entered was even");.println("The number you entered was even");.println("The number you entered was even");.println("The number you entered was even");.println("The number you entered was even");.println("The number you entered was even"); } else { } else { } else { } else { } else { } else { System. System. System.out.println("The number you entered was odd");.println("The number you entered was odd");.println("The number you entered was odd");.println("The number you entered was odd");.println("The number you entered was odd");.println("The number you entered was odd");.println("The number you entered was odd");.println("The number you entered was odd"); } } } }

}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/evenOrOdd.java

1.1 of 1 2014.12.03 13:21:11

Page 30: Text adventure

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class flowControl { {

public static void public static void public static void public static void public static void public static void public static void flowControlKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in););

int flow = 0, scan; int flow = 0, scan; int flow = 0, scan; int flow = 0, scan; int flow = 0, scan; int flow = 0, scan; int flow = 0, scan; int flow = 0, scan; int flow = 0, scan; int flow = 0, scan; int flow = 0, scan; int flow = 0, scan;

System. System. System.out.println("You enter the water control place and see a scragge".println("You enter the water control place and see a scragge".println("You enter the water control place and see a scragge".println("You enter the water control place and see a scragge".println("You enter the water control place and see a scragge".println("You enter the water control place and see a scragge" + "ly old man standing infront of you"); + "ly old man standing infront of you"); + "ly old man standing infront of you"); + "ly old man standing infront of you"); + "ly old man standing infront of you"); + "ly old man standing infront of you"); + "ly old man standing infront of you"); + "ly old man standing infront of you"); System. System. System.out.print("Man: 'oh another traveler, we have a thing to tell yo".print("Man: 'oh another traveler, we have a thing to tell yo".print("Man: 'oh another traveler, we have a thing to tell yo".print("Man: 'oh another traveler, we have a thing to tell yo".print("Man: 'oh another traveler, we have a thing to tell yo".print("Man: 'oh another traveler, we have a thing to tell yo" + "u weight on other planets, "); + "u weight on other planets, "); + "u weight on other planets, "); + "u weight on other planets, "); + "u weight on other planets, "); + "u weight on other planets, "); + "u weight on other planets, "); + "u weight on other planets, "); System. System. System.out.println("an in house lottery, and a math testing don't break".println("an in house lottery, and a math testing don't break".println("an in house lottery, and a math testing don't break".println("an in house lottery, and a math testing don't break".println("an in house lottery, and a math testing don't break".println("an in house lottery, and a math testing don't break" + " anything.'"); + " anything.'"); + " anything.'"); + " anything.'"); + " anything.'"); + " anything.'"); + " anything.'"); + " anything.'"); while (flow != 4) { while (flow != 4) { while (flow != 4) { while (flow != 4) { while (flow != 4) { while (flow != 4) { while (flow != 4) { while (flow != 4) { while (flow != 4) { while (flow != 4) { while (flow != 4) { while (flow != 4) { while (flow != 4) { scan = 0; scan = 0; scan = 0; scan = 0; scan = 0; scan = 0; scan = 0; System. System. System.out.println("Would you like to go to the 1:Space weight mach".println("Would you like to go to the 1:Space weight mach".println("Would you like to go to the 1:Space weight mach".println("Would you like to go to the 1:Space weight mach".println("Would you like to go to the 1:Space weight mach".println("Would you like to go to the 1:Space weight mach" + "ine, 2: Lottery, 3: math test, or 4: leave?"); + "ine, 2: Lottery, 3: math test, or 4: leave?"); + "ine, 2: Lottery, 3: math test, or 4: leave?"); + "ine, 2: Lottery, 3: math test, or 4: leave?"); + "ine, 2: Lottery, 3: math test, or 4: leave?"); + "ine, 2: Lottery, 3: math test, or 4: leave?"); + "ine, 2: Lottery, 3: math test, or 4: leave?"); + "ine, 2: Lottery, 3: math test, or 4: leave?"); flow = in.nextInt(); flow = in.nextInt(); flow = in.nextInt(); flow = in.nextInt(); flow = in.nextInt(); flow = in.nextInt(); flow = in.nextInt(); flow = in.nextInt(); flow = in.nextInt(); flow = in.nextInt(); flow = in.nextInt(); switch (flow) { switch (flow) { switch (flow) { switch (flow) { switch (flow) { switch (flow) { switch (flow) { switch (flow) { case 1: case 1: case 1: case 1: case 1: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { System. System. System.out.println("You walk up to the Space Weight".println("You walk up to the Space Weight".println("You walk up to the Space Weight".println("You walk up to the Space Weight".println("You walk up to the Space Weight".println("You walk up to the Space Weight" + " machine and see a keypad and a small ma" + " machine and see a keypad and a small ma" + " machine and see a keypad and a small ma" + " machine and see a keypad and a small ma" + " machine and see a keypad and a small ma" + " machine and see a keypad and a small ma" + "n with a bunch of number cards"); + "n with a bunch of number cards"); + "n with a bunch of number cards"); + "n with a bunch of number cards"); + "n with a bunch of number cards"); + "n with a bunch of number cards"); + "n with a bunch of number cards"); + "n with a bunch of number cards"); spaceWeight. spaceWeight. spaceWeight.spaceWeightKing();();(); System. System. System.out.println("'Unfortunately you will suffoca".println("'Unfortunately you will suffoca".println("'Unfortunately you will suffoca".println("'Unfortunately you will suffoca".println("'Unfortunately you will suffoca".println("'Unfortunately you will suffoca" + "te to death on these planets. Goodbye.' " + "te to death on these planets. Goodbye.' " + "te to death on these planets. Goodbye.' " + "te to death on these planets. Goodbye.' " + "te to death on these planets. Goodbye.' " + "te to death on these planets. Goodbye.' " + "The machine says."); + "The machine says."); + "The machine says."); + "The machine says."); + "The machine says."); + "The machine says."); + "The machine says."); + "The machine says."); System. System. System.out.println("You go about your journy.");.println("You go about your journy.");.println("You go about your journy.");.println("You go about your journy.");.println("You go about your journy.");.println("You go about your journy.");.println("You go about your journy.");.println("You go about your journy."); scan++;//kills loop scan++;//kills loop scan++;//kills loop scan++;//kills loop scan++;//kills loop } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number"); } } } } break; break; break; case 2: case 2: case 2: case 2: case 2: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { System. System. System.out.println("You walk into the room and find".println("You walk into the room and find".println("You walk into the room and find".println("You walk into the room and find".println("You walk into the room and find".println("You walk into the room and find" + " a lottery machine"); + " a lottery machine"); + " a lottery machine"); + " a lottery machine"); + " a lottery machine"); + " a lottery machine"); + " a lottery machine"); + " a lottery machine"); System. System. System.out.println("Machine: 'Please insert three d".println("Machine: 'Please insert three d".println("Machine: 'Please insert three d".println("Machine: 'Please insert three d".println("Machine: 'Please insert three d".println("Machine: 'Please insert three d" + "ollars and follow the instructions'"); + "ollars and follow the instructions'"); + "ollars and follow the instructions'"); + "ollars and follow the instructions'"); + "ollars and follow the instructions'"); + "ollars and follow the instructions'"); + "ollars and follow the instructions'"); + "ollars and follow the instructions'"); System. System. System.out.println("You enter three dollars.");.println("You enter three dollars.");.println("You enter three dollars.");.println("You enter three dollars.");.println("You enter three dollars.");.println("You enter three dollars.");.println("You enter three dollars.");.println("You enter three dollars."); lotteryTicket. lotteryTicket. lotteryTicket.lotteryTicketKing();();(); System. System. System.out.println("You have no idea what this mean".println("You have no idea what this mean".println("You have no idea what this mean".println("You have no idea what this mean".println("You have no idea what this mean".println("You have no idea what this mean" + "s or what the point values are used for." + "s or what the point values are used for." + "s or what the point values are used for." + "s or what the point values are used for." + "s or what the point values are used for." + "s or what the point values are used for." + ""); + ""); + ""); + ""); + ""); + ""); System. System. System.out.println("You continue on your way.");.println("You continue on your way.");.println("You continue on your way.");.println("You continue on your way.");.println("You continue on your way.");.println("You continue on your way.");.println("You continue on your way.");.println("You continue on your way."); scan++;//kills loop scan++;//kills loop scan++;//kills loop scan++;//kills loop scan++;//kills loop } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number"); } } } } break; break; break; case 3: case 3: case 3: case 3: case 3: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { System. System. System.out.println("You walk into the room and find".println("You walk into the room and find".println("You walk into the room and find".println("You walk into the room and find".println("You walk into the room and find".println("You walk into the room and find" + " a man in a business suit sitting in the" + " a man in a business suit sitting in the" + " a man in a business suit sitting in the" + " a man in a business suit sitting in the" + " a man in a business suit sitting in the" + " a man in a business suit sitting in the" + " corner"); + " corner"); + " corner"); + " corner"); + " corner"); + " corner"); + " corner"); + " corner"); System. System. System.out.println("Man: 'hello traveler, I am the ".println("Man: 'hello traveler, I am the ".println("Man: 'hello traveler, I am the ".println("Man: 'hello traveler, I am the ".println("Man: 'hello traveler, I am the ".println("Man: 'hello traveler, I am the "

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/flowControl.java

1.1 of 2 2014.12.03 15:11:49

Page 31: Text adventure

78798081828384858687888990919293949596

+ "Architect. I control this world and choo" + "Architect. I control this world and choo" + "Architect. I control this world and choo" + "Architect. I control this world and choo" + "Architect. I control this world and choo" + "Architect. I control this world and choo" + "se who gets to stay."); + "se who gets to stay."); + "se who gets to stay."); + "se who gets to stay."); + "se who gets to stay."); + "se who gets to stay."); + "se who gets to stay."); + "se who gets to stay."); System. System. System.out.println("You inquire as to how someone c".println("You inquire as to how someone c".println("You inquire as to how someone c".println("You inquire as to how someone c".println("You inquire as to how someone c".println("You inquire as to how someone c" + "ould be kicked out"); + "ould be kicked out"); + "ould be kicked out"); + "ould be kicked out"); + "ould be kicked out"); + "ould be kicked out"); + "ould be kicked out"); + "ould be kicked out"); System. System. System.out.println("Architect: 'If you fail this te".println("Architect: 'If you fail this te".println("Architect: 'If you fail this te".println("Architect: 'If you fail this te".println("Architect: 'If you fail this te".println("Architect: 'If you fail this te" + "st I am about to give you, you will be b" + "st I am about to give you, you will be b" + "st I am about to give you, you will be b" + "st I am about to give you, you will be b" + "st I am about to give you, you will be b" + "st I am about to give you, you will be b" + "anished."); + "anished."); + "anished."); + "anished."); + "anished."); + "anished."); + "anished."); + "anished."); tOrF. tOrF. tOrF.tOrFKing();();(); scan++;//kills the loop scan++;//kills the loop scan++;//kills the loop scan++;//kills the loop scan++;//kills the loop } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number"); } } } } break; break; break; } } } } } }}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/flowControl.java

2.1 of 2 2014.12.03 15:11:49

Page 32: Text adventure

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class forLoops { {

public static void public static void public static void public static void public static void public static void public static void forLoopsKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in); ); ); int forLoop = 0, scan; int forLoop = 0, scan; int forLoop = 0, scan; int forLoop = 0, scan; int forLoop = 0, scan; int forLoop = 0, scan; int forLoop = 0, scan; int forLoop = 0, scan; int forLoop = 0, scan; int forLoop = 0, scan; int forLoop = 0, scan; int forLoop = 0, scan;

System. System. System.out.println("You enter the for camp and find a clown waiting to ".println("You enter the for camp and find a clown waiting to ".println("You enter the for camp and find a clown waiting to ".println("You enter the for camp and find a clown waiting to ".println("You enter the for camp and find a clown waiting to ".println("You enter the for camp and find a clown waiting to " + "greet you."); + "greet you."); + "greet you."); + "greet you."); + "greet you."); + "greet you."); + "greet you."); + "greet you."); System. System. System.out.println("Clown: 'Welcome to the For tent, we have a few attr".println("Clown: 'Welcome to the For tent, we have a few attr".println("Clown: 'Welcome to the For tent, we have a few attr".println("Clown: 'Welcome to the For tent, we have a few attr".println("Clown: 'Welcome to the For tent, we have a few attr".println("Clown: 'Welcome to the For tent, we have a few attr" + "actions for you to visit.'"); + "actions for you to visit.'"); + "actions for you to visit.'"); + "actions for you to visit.'"); + "actions for you to visit.'"); + "actions for you to visit.'"); + "actions for you to visit.'"); + "actions for you to visit.'"); System. System. System.out.println("Clown: 'A counting game, an adding game, and a mult".println("Clown: 'A counting game, an adding game, and a mult".println("Clown: 'A counting game, an adding game, and a mult".println("Clown: 'A counting game, an adding game, and a mult".println("Clown: 'A counting game, an adding game, and a mult".println("Clown: 'A counting game, an adding game, and a mult" + "iplication game!'"); + "iplication game!'"); + "iplication game!'"); + "iplication game!'"); + "iplication game!'"); + "iplication game!'"); + "iplication game!'"); + "iplication game!'"); while (forLoop != 4) { while (forLoop != 4) { while (forLoop != 4) { while (forLoop != 4) { while (forLoop != 4) { while (forLoop != 4) { while (forLoop != 4) { while (forLoop != 4) { while (forLoop != 4) { while (forLoop != 4) { while (forLoop != 4) { while (forLoop != 4) { scan = 0; // reset sca every time the loop runs scan = 0; // reset sca every time the loop runs scan = 0; // reset sca every time the loop runs scan = 0; // reset sca every time the loop runs scan = 0; // reset sca every time the loop runs scan = 0; // reset sca every time the loop runs scan = 0; // reset sca every time the loop runs scan = 0; // reset sca every time the loop runs scan = 0; // reset sca every time the loop runs System. System. System.out.println("Would you like to visit: 1:Counting game, 2:Add".println("Would you like to visit: 1:Counting game, 2:Add".println("Would you like to visit: 1:Counting game, 2:Add".println("Would you like to visit: 1:Counting game, 2:Add".println("Would you like to visit: 1:Counting game, 2:Add".println("Would you like to visit: 1:Counting game, 2:Add" + "ing game, 3:Multiplication game, or 4: leave. "); + "ing game, 3:Multiplication game, or 4: leave. "); + "ing game, 3:Multiplication game, or 4: leave. "); + "ing game, 3:Multiplication game, or 4: leave. "); + "ing game, 3:Multiplication game, or 4: leave. "); + "ing game, 3:Multiplication game, or 4: leave. "); + "ing game, 3:Multiplication game, or 4: leave. "); + "ing game, 3:Multiplication game, or 4: leave. "); forLoop = in.nextInt(); forLoop = in.nextInt(); forLoop = in.nextInt(); forLoop = in.nextInt(); forLoop = in.nextInt(); forLoop = in.nextInt(); forLoop = in.nextInt(); forLoop = in.nextInt(); forLoop = in.nextInt(); forLoop = in.nextInt(); forLoop = in.nextInt(); switch (forLoop) { switch (forLoop) { switch (forLoop) { switch (forLoop) { switch (forLoop) { switch (forLoop) { switch (forLoop) { switch (forLoop) { case 1: case 1: case 1: case 1: case 1: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { System. System. System.out.println("You enter and see a clown cryin".println("You enter and see a clown cryin".println("You enter and see a clown cryin".println("You enter and see a clown cryin".println("You enter and see a clown cryin".println("You enter and see a clown cryin" + "g in the middle of a room."); + "g in the middle of a room."); + "g in the middle of a room."); + "g in the middle of a room."); + "g in the middle of a room."); + "g in the middle of a room."); + "g in the middle of a room."); + "g in the middle of a room."); System. System. System.out.println("Clown: 'hm... OH, OH MY A VISIT".println("Clown: 'hm... OH, OH MY A VISIT".println("Clown: 'hm... OH, OH MY A VISIT".println("Clown: 'hm... OH, OH MY A VISIT".println("Clown: 'hm... OH, OH MY A VISIT".println("Clown: 'hm... OH, OH MY A VISIT" + "OR! OH I AM SOOO LONELY!'"); + "OR! OH I AM SOOO LONELY!'"); + "OR! OH I AM SOOO LONELY!'"); + "OR! OH I AM SOOO LONELY!'"); + "OR! OH I AM SOOO LONELY!'"); + "OR! OH I AM SOOO LONELY!'"); + "OR! OH I AM SOOO LONELY!'"); + "OR! OH I AM SOOO LONELY!'"); System. System. System.out.println("The clown immediately jumps to ".println("The clown immediately jumps to ".println("The clown immediately jumps to ".println("The clown immediately jumps to ".println("The clown immediately jumps to ".println("The clown immediately jumps to " + "greet you."); + "greet you."); + "greet you."); + "greet you."); + "greet you."); + "greet you."); + "greet you."); + "greet you."); System. System. System.out.println("Clown: 'No one enjoys counting ".println("Clown: 'No one enjoys counting ".println("Clown: 'No one enjoys counting ".println("Clown: 'No one enjoys counting ".println("Clown: 'No one enjoys counting ".println("Clown: 'No one enjoys counting " + "anymore, it's been so long since I've ha" + "anymore, it's been so long since I've ha" + "anymore, it's been so long since I've ha" + "anymore, it's been so long since I've ha" + "anymore, it's been so long since I've ha" + "anymore, it's been so long since I've ha" + "d a visitor"); + "d a visitor"); + "d a visitor"); + "d a visitor"); + "d a visitor"); + "d a visitor"); + "d a visitor"); + "d a visitor"); System. System. System.out.println("Clown: 'Please do give me a num".println("Clown: 'Please do give me a num".println("Clown: 'Please do give me a num".println("Clown: 'Please do give me a num".println("Clown: 'Please do give me a num".println("Clown: 'Please do give me a num" + "ber to count to'"); + "ber to count to'"); + "ber to count to'"); + "ber to count to'"); + "ber to count to'"); + "ber to count to'"); + "ber to count to'"); + "ber to count to'"); countingNumbers. countingNumbers. countingNumbers.countingNumbersKing();();(); System. System. System.out.println("Oh yes lovely, thank you good s".println("Oh yes lovely, thank you good s".println("Oh yes lovely, thank you good s".println("Oh yes lovely, thank you good s".println("Oh yes lovely, thank you good s".println("Oh yes lovely, thank you good s" + "ir!"); + "ir!"); + "ir!"); + "ir!"); + "ir!"); + "ir!"); + "ir!"); + "ir!"); System. System. System.out.println("You attempt to exit.");.println("You attempt to exit.");.println("You attempt to exit.");.println("You attempt to exit.");.println("You attempt to exit.");.println("You attempt to exit.");.println("You attempt to exit.");.println("You attempt to exit."); System. System. System.out.println("Clown: 'Please tell them you en".println("Clown: 'Please tell them you en".println("Clown: 'Please tell them you en".println("Clown: 'Please tell them you en".println("Clown: 'Please tell them you en".println("Clown: 'Please tell them you en" + "joyed the game'"); + "joyed the game'"); + "joyed the game'"); + "joyed the game'"); + "joyed the game'"); + "joyed the game'"); + "joyed the game'"); + "joyed the game'"); scan++;//kills loop scan++;//kills loop scan++;//kills loop scan++;//kills loop scan++;//kills loop } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number"); } } } } break; break; break; case 2: case 2: case 2: case 2: case 2: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { System. System. System.out.println("You enter the room and see a ma".println("You enter the room and see a ma".println("You enter the room and see a ma".println("You enter the room and see a ma".println("You enter the room and see a ma".println("You enter the room and see a ma" + "n being held in the bottom of a well wit" + "n being held in the bottom of a well wit" + "n being held in the bottom of a well wit" + "n being held in the bottom of a well wit" + "n being held in the bottom of a well wit" + "n being held in the bottom of a well wit" + "h a clown pointing a hose at him"); + "h a clown pointing a hose at him"); + "h a clown pointing a hose at him"); + "h a clown pointing a hose at him"); + "h a clown pointing a hose at him"); + "h a clown pointing a hose at him"); + "h a clown pointing a hose at him"); + "h a clown pointing a hose at him"); System. System. System.out.println("Clown: 'Say hello!!!'");.println("Clown: 'Say hello!!!'");.println("Clown: 'Say hello!!!'");.println("Clown: 'Say hello!!!'");.println("Clown: 'Say hello!!!'");.println("Clown: 'Say hello!!!'");.println("Clown: 'Say hello!!!'");.println("Clown: 'Say hello!!!'"); System. System. System.out.println("Man: H-hello");.println("Man: H-hello");.println("Man: H-hello");.println("Man: H-hello");.println("Man: H-hello");.println("Man: H-hello");.println("Man: H-hello");.println("Man: H-hello"); System. System. System.out.println("Clown: 'ASK HIM!'");.println("Clown: 'ASK HIM!'");.println("Clown: 'ASK HIM!'");.println("Clown: 'ASK HIM!'");.println("Clown: 'ASK HIM!'");.println("Clown: 'ASK HIM!'");.println("Clown: 'ASK HIM!'");.println("Clown: 'ASK HIM!'"); System. System. System.out.println("As the clown says this he lower".println("As the clown says this he lower".println("As the clown says this he lower".println("As the clown says this he lower".println("As the clown says this he lower".println("As the clown says this he lower" + "s basket with a small chalkboard in it." + "s basket with a small chalkboard in it." + "s basket with a small chalkboard in it." + "s basket with a small chalkboard in it." + "s basket with a small chalkboard in it." + "s basket with a small chalkboard in it." ); ); ); System. System. System.out.println("Man: 'I can add! I can add a lo".println("Man: 'I can add! I can add a lo".println("Man: 'I can add! I can add a lo".println("Man: 'I can add! I can add a lo".println("Man: 'I can add! I can add a lo".println("Man: 'I can add! I can add a lo" + "t of numbers! Give me numbers!"); + "t of numbers! Give me numbers!"); + "t of numbers! Give me numbers!"); + "t of numbers! Give me numbers!"); + "t of numbers! Give me numbers!"); + "t of numbers! Give me numbers!"); + "t of numbers! Give me numbers!"); + "t of numbers! Give me numbers!");

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/forLoops.java

1.1 of 2 2014.12.03 14:59:19

Page 33: Text adventure

737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121

+ "t of numbers! Give me numbers!"); + "t of numbers! Give me numbers!"); + "t of numbers! Give me numbers!"); + "t of numbers! Give me numbers!"); + "t of numbers! Give me numbers!"); + "t of numbers! Give me numbers!"); + "t of numbers! Give me numbers!"); + "t of numbers! Give me numbers!"); dynamicAdding. dynamicAdding. dynamicAdding.dynamicAddingKing();();(); System. System. System.out.println("The clown nods and lowers the b".println("The clown nods and lowers the b".println("The clown nods and lowers the b".println("The clown nods and lowers the b".println("The clown nods and lowers the b".println("The clown nods and lowers the b" + "ask back into the well"); + "ask back into the well"); + "ask back into the well"); + "ask back into the well"); + "ask back into the well"); + "ask back into the well"); + "ask back into the well"); + "ask back into the well"); System. System. System.out.println("Clown: 'Put the chalkboard in t".println("Clown: 'Put the chalkboard in t".println("Clown: 'Put the chalkboard in t".println("Clown: 'Put the chalkboard in t".println("Clown: 'Put the chalkboard in t".println("Clown: 'Put the chalkboard in t" + "he basket'"); + "he basket'"); + "he basket'"); + "he basket'"); + "he basket'"); + "he basket'"); + "he basket'"); + "he basket'"); System. System. System.out.println("Man: 'B-but I like this chalkb.".println("Man: 'B-but I like this chalkb.".println("Man: 'B-but I like this chalkb.".println("Man: 'B-but I like this chalkb.".println("Man: 'B-but I like this chalkb.".println("Man: 'B-but I like this chalkb." + ".."); + ".."); + ".."); + ".."); + ".."); + ".."); + ".."); + ".."); System. System. System.out.println("Clown: 'PUT THE CHALKBOARD IN T".println("Clown: 'PUT THE CHALKBOARD IN T".println("Clown: 'PUT THE CHALKBOARD IN T".println("Clown: 'PUT THE CHALKBOARD IN T".println("Clown: 'PUT THE CHALKBOARD IN T".println("Clown: 'PUT THE CHALKBOARD IN T" + "HE D**N BASKET!'"); + "HE D**N BASKET!'"); + "HE D**N BASKET!'"); + "HE D**N BASKET!'"); + "HE D**N BASKET!'"); + "HE D**N BASKET!'"); + "HE D**N BASKET!'"); + "HE D**N BASKET!'"); System. System. System.out.println("This reminds you of a movie you".println("This reminds you of a movie you".println("This reminds you of a movie you".println("This reminds you of a movie you".println("This reminds you of a movie you".println("This reminds you of a movie you" + " saw once, but you can't quite put your " + " saw once, but you can't quite put your " + " saw once, but you can't quite put your " + " saw once, but you can't quite put your " + " saw once, but you can't quite put your " + " saw once, but you can't quite put your " + "finger on it."); + "finger on it."); + "finger on it."); + "finger on it."); + "finger on it."); + "finger on it."); + "finger on it."); + "finger on it."); System. System. System.out.println("You leave.");.println("You leave.");.println("You leave.");.println("You leave.");.println("You leave.");.println("You leave.");.println("You leave.");.println("You leave."); scan++;//kills loop scan++;//kills loop scan++;//kills loop scan++;//kills loop scan++;//kills loop } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number"); } } } } break; break; break; case 3: case 3: case 3: case 3: case 3: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { System. System. System.out.println("You walk into the room and see.".println("You walk into the room and see.".println("You walk into the room and see.".println("You walk into the room and see.".println("You walk into the room and see.".println("You walk into the room and see." + ".. what!"); + ".. what!"); + ".. what!"); + ".. what!"); + ".. what!"); + ".. what!"); + ".. what!"); + ".. what!"); System. System. System.out.println("Dude! It's a dragon! Really!!! ".println("Dude! It's a dragon! Really!!! ".println("Dude! It's a dragon! Really!!! ".println("Dude! It's a dragon! Really!!! ".println("Dude! It's a dragon! Really!!! ".println("Dude! It's a dragon! Really!!! " + "Oh my lord! A real Dragon! Super excited" + "Oh my lord! A real Dragon! Super excited" + "Oh my lord! A real Dragon! Super excited" + "Oh my lord! A real Dragon! Super excited" + "Oh my lord! A real Dragon! Super excited" + "Oh my lord! A real Dragon! Super excited" + "."); + "."); + "."); + "."); + "."); + "."); + "."); + "."); System. System. System.out.println("Clown: 'We taught this dragon t".println("Clown: 'We taught this dragon t".println("Clown: 'We taught this dragon t".println("Clown: 'We taught this dragon t".println("Clown: 'We taught this dragon t".println("Clown: 'We taught this dragon t" + "o multiply, go on, give him something to" + "o multiply, go on, give him something to" + "o multiply, go on, give him something to" + "o multiply, go on, give him something to" + "o multiply, go on, give him something to" + "o multiply, go on, give him something to" + " multiply."); + " multiply."); + " multiply."); + " multiply."); + " multiply."); + " multiply."); + " multiply."); + " multiply."); multipleMultiplication. multipleMultiplication. multipleMultiplication.multipleMultiplicationKing();();(); System. System. System.out.println("Dragon: 'I use to own the skies".println("Dragon: 'I use to own the skies".println("Dragon: 'I use to own the skies".println("Dragon: 'I use to own the skies".println("Dragon: 'I use to own the skies".println("Dragon: 'I use to own the skies" + ", till that blasted dovahkiin inprisoned" + ", till that blasted dovahkiin inprisoned" + ", till that blasted dovahkiin inprisoned" + ", till that blasted dovahkiin inprisoned" + ", till that blasted dovahkiin inprisoned" + ", till that blasted dovahkiin inprisoned" + " me here.'"); + " me here.'"); + " me here.'"); + " me here.'"); + " me here.'"); + " me here.'"); + " me here.'"); + " me here.'"); scan++;//kills loop scan++;//kills loop scan++;//kills loop scan++;//kills loop scan++;//kills loop } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number"); } } } } break;//kills loop break;//kills loop break;//kills loop break;//kills loop

} }

} } } }

}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/forLoops.java

2.1 of 2 2014.12.03 14:59:19

Page 34: Text adventure

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.*;import java.util.*;import java.util.*;import java.util.*;import java.util.*;import java.util.*;import java.util.*;import java.util.*;

class class fToCm { {

private static double private static double private static double private static double private static double private static double private static double height(int feet, int inches) {(int feet, int inches) {(int feet, int inches) {(int feet, int inches) {(int feet, int inches) {(int feet, int inches) {(int feet, int inches) {(int feet, int inches) {(int feet, int inches) {(int feet, int inches) {(int feet, int inches) {(int feet, int inches) { return (feet * 30.48) + (inches * 2.54); return (feet * 30.48) + (inches * 2.54); return (feet * 30.48) + (inches * 2.54); return (feet * 30.48) + (inches * 2.54); return (feet * 30.48) + (inches * 2.54); return (feet * 30.48) + (inches * 2.54); return (feet * 30.48) + (inches * 2.54); return (feet * 30.48) + (inches * 2.54); return (feet * 30.48) + (inches * 2.54); return (feet * 30.48) + (inches * 2.54); return (feet * 30.48) + (inches * 2.54); return (feet * 30.48) + (inches * 2.54); return (feet * 30.48) + (inches * 2.54); return (feet * 30.48) + (inches * 2.54); return (feet * 30.48) + (inches * 2.54); return (feet * 30.48) + (inches * 2.54); return (feet * 30.48) + (inches * 2.54); return (feet * 30.48) + (inches * 2.54); return (feet * 30.48) + (inches * 2.54); return (feet * 30.48) + (inches * 2.54); return (feet * 30.48) + (inches * 2.54); return (feet * 30.48) + (inches * 2.54); // 1 foot = 30.48 cm // 1 foot = 30.48 cm // 1 foot = 30.48 cm // 1 inch = 2.54 cm // 1 inch = 2.54 cm } }

public static void public static void public static void public static void public static void public static void public static void fToCmKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in);); int continueLoop = 0; int continueLoop = 0; int continueLoop = 0; int continueLoop = 0; int continueLoop = 0; int continueLoop = 0; int continueLoop = 0; int continueLoop = 0; int continueLoop = 0;

do { // do loop, never liked them. do { // do loop, never liked them. do { // do loop, never liked them. do { // do loop, never liked them. do { // do loop, never liked them. do { // do loop, never liked them. try { try { try { try { System. System. System.out.println("Official: 'Enter your height in feet'");.println("Official: 'Enter your height in feet'");.println("Official: 'Enter your height in feet'");.println("Official: 'Enter your height in feet'");.println("Official: 'Enter your height in feet'");.println("Official: 'Enter your height in feet'");.println("Official: 'Enter your height in feet'");.println("Official: 'Enter your height in feet'"); String feetstr = in.nextLine(); String feetstr = in.nextLine(); String feetstr = in.nextLine(); String feetstr = in.nextLine(); String feetstr = in.nextLine(); String feetstr = in.nextLine(); String feetstr = in.nextLine(); String feetstr = in.nextLine(); String feetstr = in.nextLine(); String feetstr = in.nextLine(); String feetstr = in.nextLine(); String feetstr = in.nextLine(); String feetstr = in.nextLine(); int feet = Integer. int feet = Integer. int feet = Integer. int feet = Integer. int feet = Integer. int feet = Integer. int feet = Integer. int feet = Integer. int feet = Integer.parseInt(feetstr);(feetstr);(feetstr);(feetstr); if (feet > 0) { if (feet > 0) { if (feet > 0) { if (feet > 0) { if (feet > 0) { if (feet > 0) { if (feet > 0) { if (feet > 0) { if (feet > 0) { if (feet > 0) { if (feet > 0) { if (feet > 0) { System. System. System.out.println("Official: 'and how many inches'");.println("Official: 'and how many inches'");.println("Official: 'and how many inches'");.println("Official: 'and how many inches'");.println("Official: 'and how many inches'");.println("Official: 'and how many inches'");.println("Official: 'and how many inches'");.println("Official: 'and how many inches'"); String inchesstr = in.nextLine(); String inchesstr = in.nextLine(); String inchesstr = in.nextLine(); String inchesstr = in.nextLine(); String inchesstr = in.nextLine(); String inchesstr = in.nextLine(); String inchesstr = in.nextLine(); String inchesstr = in.nextLine(); String inchesstr = in.nextLine(); String inchesstr = in.nextLine(); String inchesstr = in.nextLine(); String inchesstr = in.nextLine(); String inchesstr = in.nextLine(); int inches = Integer. int inches = Integer. int inches = Integer. int inches = Integer. int inches = Integer. int inches = Integer. int inches = Integer. int inches = Integer. int inches = Integer.parseInt(inchesstr);(inchesstr);(inchesstr);(inchesstr); if (inches > 0) { if (inches > 0) { if (inches > 0) { if (inches > 0) { if (inches > 0) { if (inches > 0) { if (inches > 0) { if (inches > 0) { if (inches > 0) { if (inches > 0) { if (inches > 0) { if (inches > 0) { double result = double result = double result = double result = double result = double result = double result = height(feet, inches);(feet, inches);(feet, inches);(feet, inches);(feet, inches);(feet, inches);(feet, inches); System. System. System.out.println("Official: 'you are " + result + " ".println("Official: 'you are " + result + " ".println("Official: 'you are " + result + " ".println("Official: 'you are " + result + " ".println("Official: 'you are " + result + " ".println("Official: 'you are " + result + " ".println("Official: 'you are " + result + " ".println("Official: 'you are " + result + " ".println("Official: 'you are " + result + " ".println("Official: 'you are " + result + " ".println("Official: 'you are " + result + " ".println("Official: 'you are " + result + " ".println("Official: 'you are " + result + " ".println("Official: 'you are " + result + " ".println("Official: 'you are " + result + " ".println("Official: 'you are " + result + " " + "cm tall.'"); + "cm tall.'"); + "cm tall.'"); + "cm tall.'"); + "cm tall.'"); + "cm tall.'"); + "cm tall.'"); + "cm tall.'"); continueLoop++; // kills loop continueLoop++; // kills loop continueLoop++; // kills loop continueLoop++; // kills loop continueLoop++; // kills loop continueLoop++; // kills loop } else { } else { } else { } else { } else { } else { throw new NumberFormatException(); throw new NumberFormatException(); throw new NumberFormatException(); throw new NumberFormatException(); throw new NumberFormatException(); throw new NumberFormatException(); throw new NumberFormatException(); throw new NumberFormatException(); throw new NumberFormatException(); } } } else { } else { } else { } else { } else { } else { throw new NumberFormatException(); throw new NumberFormatException(); throw new NumberFormatException(); throw new NumberFormatException(); throw new NumberFormatException(); throw new NumberFormatException(); throw new NumberFormatException(); throw new NumberFormatException(); throw new NumberFormatException(); } } } catch (NumberFormatException e) { } catch (NumberFormatException e) { } catch (NumberFormatException e) { } catch (NumberFormatException e) { } catch (NumberFormatException e) { } catch (NumberFormatException e) { } catch (NumberFormatException e) { } catch (NumberFormatException e) { } catch (NumberFormatException e) { } catch (NumberFormatException e) { } catch (NumberFormatException e) { } catch (NumberFormatException e) { System. System. System.out.println("Official: 'Sir, you are not negitive ".println("Official: 'Sir, you are not negitive ".println("Official: 'Sir, you are not negitive ".println("Official: 'Sir, you are not negitive ".println("Official: 'Sir, you are not negitive ".println("Official: 'Sir, you are not negitive " + "feet tall, and letters are not a hight, stop fooling" + "feet tall, and letters are not a hight, stop fooling" + "feet tall, and letters are not a hight, stop fooling" + "feet tall, and letters are not a hight, stop fooling" + "feet tall, and letters are not a hight, stop fooling" + "feet tall, and letters are not a hight, stop fooling" + " around.'"); + " around.'"); + " around.'"); + " around.'"); + " around.'"); + " around.'"); + " around.'"); + " around.'"); } } } while (continueLoop != 1); } while (continueLoop != 1); } while (continueLoop != 1); } while (continueLoop != 1); } while (continueLoop != 1); } while (continueLoop != 1); } while (continueLoop != 1); } while (continueLoop != 1); } while (continueLoop != 1); } while (continueLoop != 1); } while (continueLoop != 1); } while (continueLoop != 1); } while (continueLoop != 1); } }}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/fToCm.java

1.1 of 1 2014.12.03 14:49:03

Page 35: Text adventure

12345678910111213

15161718192021222324252627

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

public class public class public class public class iEquals3 { {

int i = 0; int i = 0; int i = 0; int i = 0; int i = 0; int i = 0; int i = 0; int i = 0; int i = 0;

iEquals3 iEquals3 iEquals3 increment() {() {() {() { i++; i++; i++; i++; return this; return this; return this; return this; return this; } }

void void void print() {() {() {() { System. System. System.out.println("i = " + i);.println("i = " + i);.println("i = " + i);.println("i = " + i);.println("i = " + i);.println("i = " + i);.println("i = " + i);.println("i = " + i);.println("i = " + i);.println("i = " + i);.println("i = " + i);.println("i = " + i); } }}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/iEquals3.java

1.1 of 1 2014.12.03 14:17:35

Page 36: Text adventure

123456789101112131415161718192021222324252627282930313233343536

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

class class idNumber { {

public static void public static void public static void public static void public static void public static void public static void idNumberKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in); ); ); String input; String input; String input; String input; String input; String input; int num; int num; int num; int num; int num;

try { try { try { try { System. System. System.out.println("Librarian: 'Out with it, tell me your Id ".println("Librarian: 'Out with it, tell me your Id ".println("Librarian: 'Out with it, tell me your Id ".println("Librarian: 'Out with it, tell me your Id ".println("Librarian: 'Out with it, tell me your Id ".println("Librarian: 'Out with it, tell me your Id " + "number.'"); + "number.'"); + "number.'"); + "number.'"); + "number.'"); + "number.'"); + "number.'"); + "number.'"); num = in.nextInt(); num = in.nextInt(); num = in.nextInt(); num = in.nextInt(); num = in.nextInt(); num = in.nextInt(); num = in.nextInt(); num = in.nextInt(); num = in.nextInt(); num = in.nextInt(); num = in.nextInt(); System. System. System.out.println("Librarian: 'This is a valid number, good.'");.println("Librarian: 'This is a valid number, good.'");.println("Librarian: 'This is a valid number, good.'");.println("Librarian: 'This is a valid number, good.'");.println("Librarian: 'This is a valid number, good.'");.println("Librarian: 'This is a valid number, good.'");.println("Librarian: 'This is a valid number, good.'");.println("Librarian: 'This is a valid number, good.'"); } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Sorry that's not in our system, please leave.");.println("Sorry that's not in our system, please leave.");.println("Sorry that's not in our system, please leave.");.println("Sorry that's not in our system, please leave.");.println("Sorry that's not in our system, please leave.");.println("Sorry that's not in our system, please leave.");.println("Sorry that's not in our system, please leave.");.println("Sorry that's not in our system, please leave.");

} }

} }

}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/idNumber.java

1.1 of 1 2014.12.03 14:50:17

Page 37: Text adventure

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class inheritance { {

public static void public static void public static void public static void public static void public static void public static void interitanceKing() {() {() {() { int choice = 0, scan; int choice = 0, scan; int choice = 0, scan; int choice = 0, scan; int choice = 0, scan; int choice = 0, scan; int choice = 0, scan; int choice = 0, scan; int choice = 0, scan; int choice = 0, scan; int choice = 0, scan; int choice = 0, scan; Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in););

System. System. System.out.println("You see a lawer standing outside");.println("You see a lawer standing outside");.println("You see a lawer standing outside");.println("You see a lawer standing outside");.println("You see a lawer standing outside");.println("You see a lawer standing outside");.println("You see a lawer standing outside");.println("You see a lawer standing outside"); System. System. System.out.println("Lawer: 'Oh good we've been expecting you'");.println("Lawer: 'Oh good we've been expecting you'");.println("Lawer: 'Oh good we've been expecting you'");.println("Lawer: 'Oh good we've been expecting you'");.println("Lawer: 'Oh good we've been expecting you'");.println("Lawer: 'Oh good we've been expecting you'");.println("Lawer: 'Oh good we've been expecting you'");.println("Lawer: 'Oh good we've been expecting you'"); System. System. System.out.println("Lawer: 'So he left you three things. However they a".println("Lawer: 'So he left you three things. However they a".println("Lawer: 'So he left you three things. However they a".println("Lawer: 'So he left you three things. However they a".println("Lawer: 'So he left you three things. However they a".println("Lawer: 'So he left you three things. However they a" + "re left through codes."); + "re left through codes."); + "re left through codes."); + "re left through codes."); + "re left through codes."); + "re left through codes."); + "re left through codes."); + "re left through codes."); System. System. System.out.println("Lawer: 'The first has to do with the radius of a ci".println("Lawer: 'The first has to do with the radius of a ci".println("Lawer: 'The first has to do with the radius of a ci".println("Lawer: 'The first has to do with the radius of a ci".println("Lawer: 'The first has to do with the radius of a ci".println("Lawer: 'The first has to do with the radius of a ci" + "rcle."); + "rcle."); + "rcle."); + "rcle."); + "rcle."); + "rcle."); + "rcle."); + "rcle."); System. System. System.out.println("Lawer: 'The second has to do with a shopping list");.println("Lawer: 'The second has to do with a shopping list");.println("Lawer: 'The second has to do with a shopping list");.println("Lawer: 'The second has to do with a shopping list");.println("Lawer: 'The second has to do with a shopping list");.println("Lawer: 'The second has to do with a shopping list");.println("Lawer: 'The second has to do with a shopping list");.println("Lawer: 'The second has to do with a shopping list"); System. System. System.out.println("Lawer: 'The third is just the number 3.");.println("Lawer: 'The third is just the number 3.");.println("Lawer: 'The third is just the number 3.");.println("Lawer: 'The third is just the number 3.");.println("Lawer: 'The third is just the number 3.");.println("Lawer: 'The third is just the number 3.");.println("Lawer: 'The third is just the number 3.");.println("Lawer: 'The third is just the number 3."); while (choice != 4) { while (choice != 4) { while (choice != 4) { while (choice != 4) { while (choice != 4) { while (choice != 4) { while (choice != 4) { while (choice != 4) { while (choice != 4) { while (choice != 4) { while (choice != 4) { while (choice != 4) { scan = 0; // reset scan at the beginning of every loop scan = 0; // reset scan at the beginning of every loop scan = 0; // reset scan at the beginning of every loop scan = 0; // reset scan at the beginning of every loop scan = 0; // reset scan at the beginning of every loop scan = 0; // reset scan at the beginning of every loop scan = 0; // reset scan at the beginning of every loop scan = 0; // reset scan at the beginning of every loop scan = 0; // reset scan at the beginning of every loop System. System. System.out.println("Choose 1: Circle, 2: Shopping, 3: 3 or 4: leave".println("Choose 1: Circle, 2: Shopping, 3: 3 or 4: leave".println("Choose 1: Circle, 2: Shopping, 3: 3 or 4: leave".println("Choose 1: Circle, 2: Shopping, 3: 3 or 4: leave".println("Choose 1: Circle, 2: Shopping, 3: 3 or 4: leave".println("Choose 1: Circle, 2: Shopping, 3: 3 or 4: leave" + ""); + ""); + ""); + ""); + ""); + ""); choice = in.nextInt(); choice = in.nextInt(); choice = in.nextInt(); choice = in.nextInt(); choice = in.nextInt(); choice = in.nextInt(); choice = in.nextInt(); choice = in.nextInt(); choice = in.nextInt(); choice = in.nextInt(); choice = in.nextInt(); switch (choice) { switch (choice) { switch (choice) { switch (choice) { switch (choice) { switch (choice) { switch (choice) { switch (choice) { case 1: case 1: case 1: case 1: case 1: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { System. System. System.out.println("Lawer: 'oh yes welcome. this wi".println("Lawer: 'oh yes welcome. this wi".println("Lawer: 'oh yes welcome. this wi".println("Lawer: 'oh yes welcome. this wi".println("Lawer: 'oh yes welcome. this wi".println("Lawer: 'oh yes welcome. this wi" + "ll be fast.'"); + "ll be fast.'"); + "ll be fast.'"); + "ll be fast.'"); + "ll be fast.'"); + "ll be fast.'"); + "ll be fast.'"); + "ll be fast.'"); areaOfCircleAgain. areaOfCircleAgain. areaOfCircleAgain.areaOfCircleAgainKing();();(); System. System. System.out.println("Lawer: That is how much money y".println("Lawer: That is how much money y".println("Lawer: That is how much money y".println("Lawer: That is how much money y".println("Lawer: That is how much money y".println("Lawer: That is how much money y" + "ou get, good, here you are.'"); + "ou get, good, here you are.'"); + "ou get, good, here you are.'"); + "ou get, good, here you are.'"); + "ou get, good, here you are.'"); + "ou get, good, here you are.'"); + "ou get, good, here you are.'"); + "ou get, good, here you are.'"); System. System. System.out.println("He hands you the money.");.println("He hands you the money.");.println("He hands you the money.");.println("He hands you the money.");.println("He hands you the money.");.println("He hands you the money.");.println("He hands you the money.");.println("He hands you the money."); System. System. System.out.println("Lawer: 'get out'");.println("Lawer: 'get out'");.println("Lawer: 'get out'");.println("Lawer: 'get out'");.println("Lawer: 'get out'");.println("Lawer: 'get out'");.println("Lawer: 'get out'");.println("Lawer: 'get out'"); scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers"); } } } } break; break; break; case 2: case 2: case 2: case 2: case 2: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { System. System. System.out.println("Lawer: 'finally, ok follow my i".println("Lawer: 'finally, ok follow my i".println("Lawer: 'finally, ok follow my i".println("Lawer: 'finally, ok follow my i".println("Lawer: 'finally, ok follow my i".println("Lawer: 'finally, ok follow my i" + "nstructions exactly please.'"); + "nstructions exactly please.'"); + "nstructions exactly please.'"); + "nstructions exactly please.'"); + "nstructions exactly please.'"); + "nstructions exactly please.'"); + "nstructions exactly please.'"); + "nstructions exactly please.'"); priceNameWeight. priceNameWeight. priceNameWeight.priceNameWeightKing();();(); System. System. System.out.println("Lawer: 'Very good, here you are".println("Lawer: 'Very good, here you are".println("Lawer: 'Very good, here you are".println("Lawer: 'Very good, here you are".println("Lawer: 'Very good, here you are".println("Lawer: 'Very good, here you are" + "'"); + "'"); + "'"); + "'"); + "'"); + "'"); + "'"); + "'"); System. System. System.out.println("He hands you the items you aske".println("He hands you the items you aske".println("He hands you the items you aske".println("He hands you the items you aske".println("He hands you the items you aske".println("He hands you the items you aske" + "d for and the amount you asked for'"); + "d for and the amount you asked for'"); + "d for and the amount you asked for'"); + "d for and the amount you asked for'"); + "d for and the amount you asked for'"); + "d for and the amount you asked for'"); + "d for and the amount you asked for'"); + "d for and the amount you asked for'"); System. System. System.out.println("Lawer: 'I hate your grandfather".println("Lawer: 'I hate your grandfather".println("Lawer: 'I hate your grandfather".println("Lawer: 'I hate your grandfather".println("Lawer: 'I hate your grandfather".println("Lawer: 'I hate your grandfather" + ", this is just rediculous.'"); + ", this is just rediculous.'"); + ", this is just rediculous.'"); + ", this is just rediculous.'"); + ", this is just rediculous.'"); + ", this is just rediculous.'"); + ", this is just rediculous.'"); + ", this is just rediculous.'"); scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers"); } } } } break; break; break; case 3: case 3: case 3: case 3: case 3: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { System. System. System.out.println("You walk into a room");.println("You walk into a room");.println("You walk into a room");.println("You walk into a room");.println("You walk into a room");.println("You walk into a room");.println("You walk into a room");.println("You walk into a room");

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/inheritance.java

1.1 of 2 2014.12.03 14:27:08

Page 38: Text adventure

7374757677787980818283848586878889909192

System. System. System.out.println("You walk into a room");.println("You walk into a room");.println("You walk into a room");.println("You walk into a room");.println("You walk into a room");.println("You walk into a room");.println("You walk into a room");.println("You walk into a room"); System. System. System.out.println("Lawer: 'you get i dollars.'");.println("Lawer: 'you get i dollars.'");.println("Lawer: 'you get i dollars.'");.println("Lawer: 'you get i dollars.'");.println("Lawer: 'you get i dollars.'");.println("Lawer: 'you get i dollars.'");.println("Lawer: 'you get i dollars.'");.println("Lawer: 'you get i dollars.'"); System. System. System.out.println("You ask how much is i");.println("You ask how much is i");.println("You ask how much is i");.println("You ask how much is i");.println("You ask how much is i");.println("You ask how much is i");.println("You ask how much is i");.println("You ask how much is i"); challenge equal = new challenge(); challenge equal = new challenge(); challenge equal = new challenge(); challenge equal = new challenge(); challenge equal = new challenge(); challenge equal = new challenge(); challenge equal = new challenge(); challenge equal = new challenge(); challenge equal = new challenge(); challenge equal = new challenge(); challenge equal = new challenge(); challenge equal = new challenge(); challenge equal = new challenge(); equal.iEquals3King(); equal.iEquals3King(); equal.iEquals3King(); equal.iEquals3King(); equal.iEquals3King(); equal.iEquals3King(); equal.iEquals3King(); System. System. System.out.println("Lawer: 'Here are your three dol".println("Lawer: 'Here are your three dol".println("Lawer: 'Here are your three dol".println("Lawer: 'Here are your three dol".println("Lawer: 'Here are your three dol".println("Lawer: 'Here are your three dol" + "lars'"); + "lars'"); + "lars'"); + "lars'"); + "lars'"); + "lars'"); + "lars'"); + "lars'"); System. System. System.out.println("You thank him and leave.");.println("You thank him and leave.");.println("You thank him and leave.");.println("You thank him and leave.");.println("You thank him and leave.");.println("You thank him and leave.");.println("You thank him and leave.");.println("You thank him and leave."); scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers"); } } } }

} } } } } }

}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/inheritance.java

2.1 of 2 2014.12.03 14:27:08

Page 39: Text adventure

12345678910111213141516171819202122232425262728293031323334353637383940414243

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.ArrayList;import java.util.ArrayList;import java.util.ArrayList;import java.util.ArrayList;import java.util.ArrayList;import java.util.ArrayList;import java.util.ArrayList;import java.util.ArrayList;

class class largestArray { {

public static void public static void public static void public static void public static void public static void public static void largestArrayKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in);); ArrayList<Integer> al = new ArrayList<>(); ArrayList<Integer> al = new ArrayList<>(); ArrayList<Integer> al = new ArrayList<>(); ArrayList<Integer> al = new ArrayList<>(); ArrayList<Integer> al = new ArrayList<>(); ArrayList<Integer> al = new ArrayList<>(); ArrayList<Integer> al = new ArrayList<>(); ArrayList<Integer> al = new ArrayList<>(); ArrayList<Integer> al = new ArrayList<>(); ArrayList<Integer> al = new ArrayList<>(); ArrayList<Integer> al = new ArrayList<>(); ArrayList<Integer> al = new ArrayList<>(); ArrayList<Integer> al = new ArrayList<>(); ArrayList<Integer> al = new ArrayList<>(); ArrayList<Integer> al = new ArrayList<>(); ArrayList<Integer> al = new ArrayList<>(); ArrayList<Integer> al = new ArrayList<>(); ArrayList<Integer> al = new ArrayList<>(); System. System. System.out.println("How many numbers will you give him?");.println("How many numbers will you give him?");.println("How many numbers will you give him?");.println("How many numbers will you give him?");.println("How many numbers will you give him?");.println("How many numbers will you give him?");.println("How many numbers will you give him?");.println("How many numbers will you give him?"); int size = in.nextInt(); int size = in.nextInt(); int size = in.nextInt(); int size = in.nextInt(); int size = in.nextInt(); int size = in.nextInt(); int size = in.nextInt(); int size = in.nextInt(); int size = in.nextInt(); int size = in.nextInt(); int size = in.nextInt(); int size = in.nextInt(); int size = in.nextInt(); System. System. System.out.println("tell him " +size +" integers.");.println("tell him " +size +" integers.");.println("tell him " +size +" integers.");.println("tell him " +size +" integers.");.println("tell him " +size +" integers.");.println("tell him " +size +" integers.");.println("tell him " +size +" integers.");.println("tell him " +size +" integers.");.println("tell him " +size +" integers.");.println("tell him " +size +" integers.");.println("tell him " +size +" integers.");.println("tell him " +size +" integers.");.println("tell him " +size +" integers.");.println("tell him " +size +" integers.");.println("tell him " +size +" integers.");.println("tell him " +size +" integers."); // enter that many numbers to the array list // enter that many numbers to the array list while (size-- > 0) { while (size-- > 0) { while (size-- > 0) { while (size-- > 0) { while (size-- > 0) { while (size-- > 0) { while (size-- > 0) { while (size-- > 0) { while (size-- > 0) { while (size-- > 0) { while (size-- > 0) { while (size-- > 0) { while (size-- > 0) { // To add an element to the ArrayList // To add an element to the ArrayList al.add(in.nextInt()); al.add(in.nextInt()); al.add(in.nextInt()); al.add(in.nextInt()); al.add(in.nextInt()); al.add(in.nextInt()); al.add(in.nextInt()); al.add(in.nextInt()); al.add(in.nextInt()); al.add(in.nextInt()); al.add(in.nextInt()); al.add(in.nextInt()); } } int max = Integer. int max = Integer. int max = Integer. int max = Integer. int max = Integer. int max = Integer. int max = Integer. int max = Integer. int max = Integer.MIN_VALUE;

// determines largest integer // determines largest integer for (Integer i : al) { for (Integer i : al) { for (Integer i : al) { for (Integer i : al) { for (Integer i : al) { for (Integer i : al) { for (Integer i : al) { for (Integer i : al) { for (Integer i : al) { for (Integer i : al) { for (Integer i : al) { for (Integer i : al) { for (Integer i : al) { for (Integer i : al) { if (max < i) { if (max < i) { if (max < i) { if (max < i) { if (max < i) { if (max < i) { if (max < i) { if (max < i) { if (max < i) { if (max < i) { if (max < i) { if (max < i) { max = i; max = i; max = i; max = i; max = i; max = i; max = i; } } } }

System. System. System.out.println("Man: The largest value is " + max + ".");.println("Man: The largest value is " + max + ".");.println("Man: The largest value is " + max + ".");.println("Man: The largest value is " + max + ".");.println("Man: The largest value is " + max + ".");.println("Man: The largest value is " + max + ".");.println("Man: The largest value is " + max + ".");.println("Man: The largest value is " + max + ".");.println("Man: The largest value is " + max + ".");.println("Man: The largest value is " + max + ".");.println("Man: The largest value is " + max + ".");.println("Man: The largest value is " + max + ".");.println("Man: The largest value is " + max + ".");.println("Man: The largest value is " + max + ".");.println("Man: The largest value is " + max + ".");.println("Man: The largest value is " + max + ".");.println("Man: The largest value is " + max + ".");.println("Man: The largest value is " + max + "."); } }

}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/largestArray.java

1.1 of 1 2014.12.03 14:14:31

Page 40: Text adventure

123456789101112131415161718192021222324252627282930313233343536373839404142434445

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.ArrayList;import java.util.ArrayList;import java.util.ArrayList;import java.util.ArrayList;import java.util.ArrayList;import java.util.ArrayList;import java.util.ArrayList;import java.util.ArrayList;

class class longestArrayPosition { {

public static void public static void public static void public static void public static void public static void public static void longestArrayPositionKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in);); ArrayList<Integer> al = new ArrayList<>(); ArrayList<Integer> al = new ArrayList<>(); ArrayList<Integer> al = new ArrayList<>(); ArrayList<Integer> al = new ArrayList<>(); ArrayList<Integer> al = new ArrayList<>(); ArrayList<Integer> al = new ArrayList<>(); ArrayList<Integer> al = new ArrayList<>(); ArrayList<Integer> al = new ArrayList<>(); ArrayList<Integer> al = new ArrayList<>(); ArrayList<Integer> al = new ArrayList<>(); ArrayList<Integer> al = new ArrayList<>(); ArrayList<Integer> al = new ArrayList<>(); ArrayList<Integer> al = new ArrayList<>(); ArrayList<Integer> al = new ArrayList<>(); ArrayList<Integer> al = new ArrayList<>(); ArrayList<Integer> al = new ArrayList<>(); ArrayList<Integer> al = new ArrayList<>(); ArrayList<Integer> al = new ArrayList<>(); System. System. System.out.println("How many numbers would you like to give him?");.println("How many numbers would you like to give him?");.println("How many numbers would you like to give him?");.println("How many numbers would you like to give him?");.println("How many numbers would you like to give him?");.println("How many numbers would you like to give him?");.println("How many numbers would you like to give him?");.println("How many numbers would you like to give him?"); int size = in.nextInt(); int size = in.nextInt(); int size = in.nextInt(); int size = in.nextInt(); int size = in.nextInt(); int size = in.nextInt(); int size = in.nextInt(); int size = in.nextInt(); int size = in.nextInt(); int size = in.nextInt(); int size = in.nextInt(); int size = in.nextInt(); int size = in.nextInt(); System. System. System.out.println("Tell him" + size + " numbers.");.println("Tell him" + size + " numbers.");.println("Tell him" + size + " numbers.");.println("Tell him" + size + " numbers.");.println("Tell him" + size + " numbers.");.println("Tell him" + size + " numbers.");.println("Tell him" + size + " numbers.");.println("Tell him" + size + " numbers.");.println("Tell him" + size + " numbers.");.println("Tell him" + size + " numbers.");.println("Tell him" + size + " numbers.");.println("Tell him" + size + " numbers.");.println("Tell him" + size + " numbers.");.println("Tell him" + size + " numbers.");.println("Tell him" + size + " numbers.");.println("Tell him" + size + " numbers.");.println("Tell him" + size + " numbers.");.println("Tell him" + size + " numbers."); while (size-- > 0) { while (size-- > 0) { while (size-- > 0) { while (size-- > 0) { while (size-- > 0) { while (size-- > 0) { while (size-- > 0) { while (size-- > 0) { while (size-- > 0) { while (size-- > 0) { while (size-- > 0) { while (size-- > 0) { while (size-- > 0) { // To add an element to the ArrayList // To add an element to the ArrayList al.add(in.nextInt()); al.add(in.nextInt()); al.add(in.nextInt()); al.add(in.nextInt()); al.add(in.nextInt()); al.add(in.nextInt()); al.add(in.nextInt()); al.add(in.nextInt()); al.add(in.nextInt()); al.add(in.nextInt()); al.add(in.nextInt()); al.add(in.nextInt()); } } int max = Integer. int max = Integer. int max = Integer. int max = Integer. int max = Integer. int max = Integer. int max = Integer. int max = Integer. int max = Integer.MIN_VALUE; int maxindex = 0; int maxindex = 0; int maxindex = 0; int maxindex = 0; int maxindex = 0; int maxindex = 0; int maxindex = 0; int maxindex = 0; int maxindex = 0;

// determines the largest value and location of said value // determines the largest value and location of said value for (int i = 0; i < al.size(); i++) { for (int i = 0; i < al.size(); i++) { for (int i = 0; i < al.size(); i++) { for (int i = 0; i < al.size(); i++) { for (int i = 0; i < al.size(); i++) { for (int i = 0; i < al.size(); i++) { for (int i = 0; i < al.size(); i++) { for (int i = 0; i < al.size(); i++) { for (int i = 0; i < al.size(); i++) { for (int i = 0; i < al.size(); i++) { for (int i = 0; i < al.size(); i++) { for (int i = 0; i < al.size(); i++) { for (int i = 0; i < al.size(); i++) { for (int i = 0; i < al.size(); i++) { for (int i = 0; i < al.size(); i++) { for (int i = 0; i < al.size(); i++) { for (int i = 0; i < al.size(); i++) { for (int i = 0; i < al.size(); i++) { for (int i = 0; i < al.size(); i++) { for (int i = 0; i < al.size(); i++) { for (int i = 0; i < al.size(); i++) { for (int i = 0; i < al.size(); i++) { for (int i = 0; i < al.size(); i++) { for (int i = 0; i < al.size(); i++) { for (int i = 0; i < al.size(); i++) { for (int i = 0; i < al.size(); i++) { for (int i = 0; i < al.size(); i++) { for (int i = 0; i < al.size(); i++) { for (int i = 0; i < al.size(); i++) { if (max < al.get(i)) { if (max < al.get(i)) { if (max < al.get(i)) { if (max < al.get(i)) { if (max < al.get(i)) { if (max < al.get(i)) { if (max < al.get(i)) { if (max < al.get(i)) { if (max < al.get(i)) { if (max < al.get(i)) { if (max < al.get(i)) { if (max < al.get(i)) { if (max < al.get(i)) { if (max < al.get(i)) { if (max < al.get(i)) { if (max < al.get(i)) { if (max < al.get(i)) { max = al.get(i); max = al.get(i); max = al.get(i); max = al.get(i); max = al.get(i); max = al.get(i); max = al.get(i); max = al.get(i); max = al.get(i); max = al.get(i); max = al.get(i); max = al.get(i); maxindex = i; maxindex = i; maxindex = i; maxindex = i; maxindex = i; maxindex = i; maxindex = i; } } } }

System. System. System.out.println("Man: The largest value is " + max + "; which is in ".println("Man: The largest value is " + max + "; which is in ".println("Man: The largest value is " + max + "; which is in ".println("Man: The largest value is " + max + "; which is in ".println("Man: The largest value is " + max + "; which is in ".println("Man: The largest value is " + max + "; which is in ".println("Man: The largest value is " + max + "; which is in ".println("Man: The largest value is " + max + "; which is in ".println("Man: The largest value is " + max + "; which is in ".println("Man: The largest value is " + max + "; which is in ".println("Man: The largest value is " + max + "; which is in ".println("Man: The largest value is " + max + "; which is in ".println("Man: The largest value is " + max + "; which is in ".println("Man: The largest value is " + max + "; which is in ".println("Man: The largest value is " + max + "; which is in ".println("Man: The largest value is " + max + "; which is in " + "slot " + maxindex); + "slot " + maxindex); + "slot " + maxindex); + "slot " + maxindex); + "slot " + maxindex); + "slot " + maxindex); + "slot " + maxindex); + "slot " + maxindex); + "slot " + maxindex); + "slot " + maxindex); + "slot " + maxindex); + "slot " + maxindex); } }

}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/longestArrayPosition.java

1.1 of 1 2014.12.03 14:09:33

Page 41: Text adventure

12345678910111213141516171819202122232425262728293031323334353637383940414243

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.ArrayList;import java.util.ArrayList;import java.util.ArrayList;import java.util.ArrayList;import java.util.ArrayList;import java.util.ArrayList;import java.util.ArrayList;import java.util.ArrayList;

class class longestString { {

public static void public static void public static void public static void public static void public static void public static void longestStringKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in);); System. System. System.out.println("How many words would you like to give him?");.println("How many words would you like to give him?");.println("How many words would you like to give him?");.println("How many words would you like to give him?");.println("How many words would you like to give him?");.println("How many words would you like to give him?");.println("How many words would you like to give him?");.println("How many words would you like to give him?"); int length = in.nextInt(); int length = in.nextInt(); int length = in.nextInt(); int length = in.nextInt(); int length = in.nextInt(); int length = in.nextInt(); int length = in.nextInt(); int length = in.nextInt(); int length = in.nextInt(); int length = in.nextInt(); int length = in.nextInt(); int length = in.nextInt(); int length = in.nextInt(); ArrayList<String> al = new ArrayList<>(); ArrayList<String> al = new ArrayList<>(); ArrayList<String> al = new ArrayList<>(); ArrayList<String> al = new ArrayList<>(); ArrayList<String> al = new ArrayList<>(); ArrayList<String> al = new ArrayList<>(); ArrayList<String> al = new ArrayList<>(); ArrayList<String> al = new ArrayList<>(); ArrayList<String> al = new ArrayList<>(); ArrayList<String> al = new ArrayList<>(); ArrayList<String> al = new ArrayList<>(); ArrayList<String> al = new ArrayList<>(); ArrayList<String> al = new ArrayList<>(); ArrayList<String> al = new ArrayList<>(); ArrayList<String> al = new ArrayList<>(); ArrayList<String> al = new ArrayList<>(); ArrayList<String> al = new ArrayList<>(); ArrayList<String> al = new ArrayList<>(); System. System. System.out.println("Tell him some words");.println("Tell him some words");.println("Tell him some words");.println("Tell him some words");.println("Tell him some words");.println("Tell him some words");.println("Tell him some words");.println("Tell him some words"); for (int i = 0; i <= length; i++) { for (int i = 0; i <= length; i++) { for (int i = 0; i <= length; i++) { for (int i = 0; i <= length; i++) { for (int i = 0; i <= length; i++) { for (int i = 0; i <= length; i++) { for (int i = 0; i <= length; i++) { for (int i = 0; i <= length; i++) { for (int i = 0; i <= length; i++) { for (int i = 0; i <= length; i++) { for (int i = 0; i <= length; i++) { for (int i = 0; i <= length; i++) { for (int i = 0; i <= length; i++) { for (int i = 0; i <= length; i++) { for (int i = 0; i <= length; i++) { for (int i = 0; i <= length; i++) { for (int i = 0; i <= length; i++) { for (int i = 0; i <= length; i++) { for (int i = 0; i <= length; i++) { for (int i = 0; i <= length; i++) { for (int i = 0; i <= length; i++) { for (int i = 0; i <= length; i++) { for (int i = 0; i <= length; i++) { for (int i = 0; i <= length; i++) { for (int i = 0; i <= length; i++) { // To add an element to the ArrayList // To add an element to the ArrayList al.add(in.nextLine()); al.add(in.nextLine()); al.add(in.nextLine()); al.add(in.nextLine()); al.add(in.nextLine()); al.add(in.nextLine()); al.add(in.nextLine()); al.add(in.nextLine()); al.add(in.nextLine()); al.add(in.nextLine()); al.add(in.nextLine()); al.add(in.nextLine()); } } int max = Integer. int max = Integer. int max = Integer. int max = Integer. int max = Integer. int max = Integer. int max = Integer. int max = Integer. int max = Integer.MIN_VALUE;

// Determines the entry with the largest number of characters // Determines the entry with the largest number of characters for (String i : al) { for (String i : al) { for (String i : al) { for (String i : al) { for (String i : al) { for (String i : al) { for (String i : al) { for (String i : al) { for (String i : al) { for (String i : al) { for (String i : al) { for (String i : al) { for (String i : al) { for (String i : al) { for (String i : al) { if (max < i.length()) { if (max < i.length()) { if (max < i.length()) { if (max < i.length()) { if (max < i.length()) { if (max < i.length()) { if (max < i.length()) { if (max < i.length()) { if (max < i.length()) { if (max < i.length()) { if (max < i.length()) { if (max < i.length()) { if (max < i.length()) { if (max < i.length()) { if (max < i.length()) { if (max < i.length()) { max = i.length(); max = i.length(); max = i.length(); max = i.length(); max = i.length(); max = i.length(); max = i.length(); max = i.length(); max = i.length(); max = i.length(); max = i.length(); } } } }

System. System. System.out.println("Man: The longest word was " + max + " letters long.".println("Man: The longest word was " + max + " letters long.".println("Man: The longest word was " + max + " letters long.".println("Man: The longest word was " + max + " letters long.".println("Man: The longest word was " + max + " letters long.".println("Man: The longest word was " + max + " letters long.".println("Man: The longest word was " + max + " letters long.".println("Man: The longest word was " + max + " letters long.".println("Man: The longest word was " + max + " letters long.".println("Man: The longest word was " + max + " letters long.".println("Man: The longest word was " + max + " letters long.".println("Man: The longest word was " + max + " letters long.".println("Man: The longest word was " + max + " letters long.".println("Man: The longest word was " + max + " letters long.".println("Man: The longest word was " + max + " letters long.".println("Man: The longest word was " + max + " letters long." + ""); + ""); + ""); + ""); + ""); + ""); } }

}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/longestString.java

1.1 of 1 2014.12.03 14:12:11

Page 42: Text adventure

1234567891011121314151617

192021222324252627282930313233343536373839404142434445464748495051525354555657585960

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class loops { {

public static void public static void public static void public static void public static void public static void public static void loopKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in); ); ); int loops2 = 0, scan; int loops2 = 0, scan; int loops2 = 0, scan; int loops2 = 0, scan; int loops2 = 0, scan; int loops2 = 0, scan; int loops2 = 0, scan; int loops2 = 0, scan; int loops2 = 0, scan; int loops2 = 0, scan; int loops2 = 0, scan; int loops2 = 0, scan;

System. System. System.out.println("You walk up to the area and two clowns greet you.");.println("You walk up to the area and two clowns greet you.");.println("You walk up to the area and two clowns greet you.");.println("You walk up to the area and two clowns greet you.");.println("You walk up to the area and two clowns greet you.");.println("You walk up to the area and two clowns greet you.");.println("You walk up to the area and two clowns greet you.");.println("You walk up to the area and two clowns greet you."); System. System. System.out.println("One of them brandishes a 'for' on his chest, the ot".println("One of them brandishes a 'for' on his chest, the ot".println("One of them brandishes a 'for' on his chest, the ot".println("One of them brandishes a 'for' on his chest, the ot".println("One of them brandishes a 'for' on his chest, the ot".println("One of them brandishes a 'for' on his chest, the ot" + "her has the word 'while' printed on his."); + "her has the word 'while' printed on his."); + "her has the word 'while' printed on his."); + "her has the word 'while' printed on his."); + "her has the word 'while' printed on his."); + "her has the word 'while' printed on his."); + "her has the word 'while' printed on his."); + "her has the word 'while' printed on his."); System. System. System.out.println("For clown: 'Oh good a traveler come the Circus is t".println("For clown: 'Oh good a traveler come the Circus is t".println("For clown: 'Oh good a traveler come the Circus is t".println("For clown: 'Oh good a traveler come the Circus is t".println("For clown: 'Oh good a traveler come the Circus is t".println("For clown: 'Oh good a traveler come the Circus is t" + "his way.'"); + "his way.'"); + "his way.'"); + "his way.'"); + "his way.'"); + "his way.'"); + "his way.'"); + "his way.'"); System. System. System.out.println("While clown: 'Oh sorry he is mistaken, it's really ".println("While clown: 'Oh sorry he is mistaken, it's really ".println("While clown: 'Oh sorry he is mistaken, it's really ".println("While clown: 'Oh sorry he is mistaken, it's really ".println("While clown: 'Oh sorry he is mistaken, it's really ".println("While clown: 'Oh sorry he is mistaken, it's really " + "this way'"); + "this way'"); + "this way'"); + "this way'"); + "this way'"); + "this way'"); + "this way'"); + "this way'"); while (loops2 != 3) { while (loops2 != 3) { while (loops2 != 3) { while (loops2 != 3) { while (loops2 != 3) { while (loops2 != 3) { while (loops2 != 3) { while (loops2 != 3) { while (loops2 != 3) { while (loops2 != 3) { while (loops2 != 3) { while (loops2 != 3) { scan = 0; // reset scan at the beginning of the loop. scan = 0; // reset scan at the beginning of the loop. scan = 0; // reset scan at the beginning of the loop. scan = 0; // reset scan at the beginning of the loop. scan = 0; // reset scan at the beginning of the loop. scan = 0; // reset scan at the beginning of the loop. scan = 0; // reset scan at the beginning of the loop. scan = 0; // reset scan at the beginning of the loop. scan = 0; // reset scan at the beginning of the loop. System. System. System.out.println("Which clown do you with to follow? ");.println("Which clown do you with to follow? ");.println("Which clown do you with to follow? ");.println("Which clown do you with to follow? ");.println("Which clown do you with to follow? ");.println("Which clown do you with to follow? ");.println("Which clown do you with to follow? ");.println("Which clown do you with to follow? "); System. System. System.out.println("1: While clown, 2: for clown, or 3: Leave.");.println("1: While clown, 2: for clown, or 3: Leave.");.println("1: While clown, 2: for clown, or 3: Leave.");.println("1: While clown, 2: for clown, or 3: Leave.");.println("1: While clown, 2: for clown, or 3: Leave.");.println("1: While clown, 2: for clown, or 3: Leave.");.println("1: While clown, 2: for clown, or 3: Leave.");.println("1: While clown, 2: for clown, or 3: Leave."); loops2 = in.nextInt(); loops2 = in.nextInt(); loops2 = in.nextInt(); loops2 = in.nextInt(); loops2 = in.nextInt(); loops2 = in.nextInt(); loops2 = in.nextInt(); loops2 = in.nextInt(); loops2 = in.nextInt(); loops2 = in.nextInt(); loops2 = in.nextInt(); switch (loops2) { switch (loops2) { switch (loops2) { switch (loops2) { switch (loops2) { switch (loops2) { switch (loops2) { switch (loops2) { case 1: case 1: case 1: case 1: case 1: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { whileLoops. whileLoops. whileLoops.whileLoopsKing();();(); scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number"); } } } } break; break; break; case 2: case 2: case 2: case 2: case 2: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { forLoops. forLoops. forLoops.forLoopsKing();();(); scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number"); } } } } break; break; break; } } } }

} }}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/loops.java

1.1 of 1 2014.12.03 15:22:19

Page 43: Text adventure

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class lotteryTicket { {

public static void public static void public static void public static void public static void public static void public static void lotteryTicketKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in); ); ); int a = 0, b = 0, c = 0, s, i = 0; int a = 0, b = 0, c = 0, s, i = 0; int a = 0, b = 0, c = 0, s, i = 0; int a = 0, b = 0, c = 0, s, i = 0; int a = 0, b = 0, c = 0, s, i = 0; int a = 0, b = 0, c = 0, s, i = 0; int a = 0, b = 0, c = 0, s, i = 0; int a = 0, b = 0, c = 0, s, i = 0; int a = 0, b = 0, c = 0, s, i = 0; int a = 0, b = 0, c = 0, s, i = 0; int a = 0, b = 0, c = 0, s, i = 0; int a = 0, b = 0, c = 0, s, i = 0; int a = 0, b = 0, c = 0, s, i = 0; int a = 0, b = 0, c = 0, s, i = 0; int a = 0, b = 0, c = 0, s, i = 0; int a = 0, b = 0, c = 0, s, i = 0; int a = 0, b = 0, c = 0, s, i = 0; int a = 0, b = 0, c = 0, s, i = 0; int a = 0, b = 0, c = 0, s, i = 0; int a = 0, b = 0, c = 0, s, i = 0; int a = 0, b = 0, c = 0, s, i = 0; int a = 0, b = 0, c = 0, s, i = 0; int a = 0, b = 0, c = 0, s, i = 0; int a = 0, b = 0, c = 0, s, i = 0; int a = 0, b = 0, c = 0, s, i = 0; int a = 0, b = 0, c = 0, s, i = 0; int a = 0, b = 0, c = 0, s, i = 0; int a = 0, b = 0, c = 0, s, i = 0; int a = 0, b = 0, c = 0, s, i = 0; int a = 0, b = 0, c = 0, s, i = 0; int a = 0, b = 0, c = 0, s, i = 0; int a = 0, b = 0, c = 0, s, i = 0; int a = 0, b = 0, c = 0, s, i = 0; while (i != 1) { while (i != 1) { while (i != 1) { while (i != 1) { while (i != 1) { while (i != 1) { while (i != 1) { while (i != 1) { while (i != 1) { while (i != 1) { while (i != 1) { while (i != 1) { System. System. System.out.println("Enter 3 values from 0 to 2:");.println("Enter 3 values from 0 to 2:");.println("Enter 3 values from 0 to 2:");.println("Enter 3 values from 0 to 2:");.println("Enter 3 values from 0 to 2:");.println("Enter 3 values from 0 to 2:");.println("Enter 3 values from 0 to 2:");.println("Enter 3 values from 0 to 2:"); a = in.nextInt(); a = in.nextInt(); a = in.nextInt(); a = in.nextInt(); a = in.nextInt(); a = in.nextInt(); a = in.nextInt(); a = in.nextInt(); a = in.nextInt(); a = in.nextInt(); a = in.nextInt(); b = in.nextInt(); b = in.nextInt(); b = in.nextInt(); b = in.nextInt(); b = in.nextInt(); b = in.nextInt(); b = in.nextInt(); b = in.nextInt(); b = in.nextInt(); b = in.nextInt(); b = in.nextInt(); c = in.nextInt(); c = in.nextInt(); c = in.nextInt(); c = in.nextInt(); c = in.nextInt(); c = in.nextInt(); c = in.nextInt(); c = in.nextInt(); c = in.nextInt(); c = in.nextInt(); c = in.nextInt(); if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { if (a > 2 || b > 2 || c > 2 || a < 0 || b < 0 || c < 0) { System. System. System.out.println("Enter numbers only between 0 and 2.");.println("Enter numbers only between 0 and 2.");.println("Enter numbers only between 0 and 2.");.println("Enter numbers only between 0 and 2.");.println("Enter numbers only between 0 and 2.");.println("Enter numbers only between 0 and 2.");.println("Enter numbers only between 0 and 2.");.println("Enter numbers only between 0 and 2."); }else{ }else{ }else{ }else{ i++; // restricts the variables to being between 1 and 2 i++; // restricts the variables to being between 1 and 2 i++; // restricts the variables to being between 1 and 2 i++; // restricts the variables to being between 1 and 2 i++; // restricts the variables to being between 1 and 2 i++; // restricts the variables to being between 1 and 2 } } } }

if (a == 2 && b == 2 && c == 2) { //covers all possibilities if (a == 2 && b == 2 && c == 2) { //covers all possibilities if (a == 2 && b == 2 && c == 2) { //covers all possibilities if (a == 2 && b == 2 && c == 2) { //covers all possibilities if (a == 2 && b == 2 && c == 2) { //covers all possibilities if (a == 2 && b == 2 && c == 2) { //covers all possibilities if (a == 2 && b == 2 && c == 2) { //covers all possibilities if (a == 2 && b == 2 && c == 2) { //covers all possibilities if (a == 2 && b == 2 && c == 2) { //covers all possibilities if (a == 2 && b == 2 && c == 2) { //covers all possibilities if (a == 2 && b == 2 && c == 2) { //covers all possibilities if (a == 2 && b == 2 && c == 2) { //covers all possibilities if (a == 2 && b == 2 && c == 2) { //covers all possibilities if (a == 2 && b == 2 && c == 2) { //covers all possibilities if (a == 2 && b == 2 && c == 2) { //covers all possibilities if (a == 2 && b == 2 && c == 2) { //covers all possibilities if (a == 2 && b == 2 && c == 2) { //covers all possibilities if (a == 2 && b == 2 && c == 2) { //covers all possibilities if (a == 2 && b == 2 && c == 2) { //covers all possibilities if (a == 2 && b == 2 && c == 2) { //covers all possibilities if (a == 2 && b == 2 && c == 2) { //covers all possibilities if (a == 2 && b == 2 && c == 2) { //covers all possibilities if (a == 2 && b == 2 && c == 2) { //covers all possibilities if (a == 2 && b == 2 && c == 2) { //covers all possibilities if (a == 2 && b == 2 && c == 2) { //covers all possibilities if (a == 2 && b == 2 && c == 2) { //covers all possibilities if (a == 2 && b == 2 && c == 2) { //covers all possibilities if (a == 2 && b == 2 && c == 2) { //covers all possibilities if (a == 2 && b == 2 && c == 2) { //covers all possibilities if (a == 2 && b == 2 && c == 2) { //covers all possibilities if (a == 2 && b == 2 && c == 2) { //covers all possibilities s = 10; s = 10; s = 10; s = 10; s = 10; s = 10; s = 10; } else if (a == b && b == c) { } else if (a == b && b == c) { } else if (a == b && b == c) { } else if (a == b && b == c) { } else if (a == b && b == c) { } else if (a == b && b == c) { } else if (a == b && b == c) { } else if (a == b && b == c) { } else if (a == b && b == c) { } else if (a == b && b == c) { } else if (a == b && b == c) { } else if (a == b && b == c) { } else if (a == b && b == c) { } else if (a == b && b == c) { } else if (a == b && b == c) { } else if (a == b && b == c) { } else if (a == b && b == c) { } else if (a == b && b == c) { } else if (a == b && b == c) { } else if (a == b && b == c) { } else if (a == b && b == c) { } else if (a == b && b == c) { } else if (a == b && b == c) { } else if (a == b && b == c) { s = 5; s = 5; s = 5; s = 5; s = 5; s = 5; s = 5; } else if (a != b && c != a) { } else if (a != b && c != a) { } else if (a != b && c != a) { } else if (a != b && c != a) { } else if (a != b && c != a) { } else if (a != b && c != a) { } else if (a != b && c != a) { } else if (a != b && c != a) { } else if (a != b && c != a) { } else if (a != b && c != a) { } else if (a != b && c != a) { } else if (a != b && c != a) { } else if (a != b && c != a) { } else if (a != b && c != a) { } else if (a != b && c != a) { } else if (a != b && c != a) { } else if (a != b && c != a) { } else if (a != b && c != a) { } else if (a != b && c != a) { } else if (a != b && c != a) { } else if (a != b && c != a) { } else if (a != b && c != a) { } else if (a != b && c != a) { } else if (a != b && c != a) { s = 1; s = 1; s = 1; s = 1; s = 1; s = 1; s = 1; } else { } else { } else { } else { } else { } else { s = 0; s = 0; s = 0; s = 0; s = 0; s = 0; s = 0; } }

System. System. System.out.println("Value of your ticket:" + s);.println("Value of your ticket:" + s);.println("Value of your ticket:" + s);.println("Value of your ticket:" + s);.println("Value of your ticket:" + s);.println("Value of your ticket:" + s);.println("Value of your ticket:" + s);.println("Value of your ticket:" + s);.println("Value of your ticket:" + s);.println("Value of your ticket:" + s);.println("Value of your ticket:" + s);.println("Value of your ticket:" + s); } }

}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/lotteryTicket.java

1.1 of 1 2014.12.03 15:07:12

Page 44: Text adventure

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class luckyNumber { {

public static void public static void public static void public static void public static void public static void public static void luckyNumberKing() {() {() {() {

String num1, num5; String num1, num5; String num1, num5; String num1, num5; String num1, num5; String num1, num5; String num1, num5; String num1, num5; char num2, num7; char num2, num7; char num2, num7; char num2, num7; char num2, num7; char num2, num7; char num2, num7; char num2, num7; int num3, num4 = 0, num6 = 0, num8; int num3, num4 = 0, num6 = 0, num8; int num3, num4 = 0, num6 = 0, num8; int num3, num4 = 0, num6 = 0, num8; int num3, num4 = 0, num6 = 0, num8; int num3, num4 = 0, num6 = 0, num8; int num3, num4 = 0, num6 = 0, num8; int num3, num4 = 0, num6 = 0, num8; int num3, num4 = 0, num6 = 0, num8; int num3, num4 = 0, num6 = 0, num8; int num3, num4 = 0, num6 = 0, num8; int num3, num4 = 0, num6 = 0, num8; int num3, num4 = 0, num6 = 0, num8; int num3, num4 = 0, num6 = 0, num8; int num3, num4 = 0, num6 = 0, num8; int num3, num4 = 0, num6 = 0, num8; int num3, num4 = 0, num6 = 0, num8; int num3, num4 = 0, num6 = 0, num8; int num3, num4 = 0, num6 = 0, num8; int num3, num4 = 0, num6 = 0, num8; int num3, num4 = 0, num6 = 0, num8; int num3, num4 = 0, num6 = 0, num8;

Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in); ); ); System. System. System.out.println("Enter Your birthdate(ddmmyy)");.println("Enter Your birthdate(ddmmyy)");.println("Enter Your birthdate(ddmmyy)");.println("Enter Your birthdate(ddmmyy)");.println("Enter Your birthdate(ddmmyy)");.println("Enter Your birthdate(ddmmyy)");.println("Enter Your birthdate(ddmmyy)");.println("Enter Your birthdate(ddmmyy)"); num1 = in.nextLine(); num1 = in.nextLine(); num1 = in.nextLine(); num1 = in.nextLine(); num1 = in.nextLine(); num1 = in.nextLine(); num1 = in.nextLine(); num1 = in.nextLine(); num1 = in.nextLine(); num1 = in.nextLine(); num1 = in.nextLine(); for (int count = 0; count < num1.length(); count++) { for (int count = 0; count < num1.length(); count++) { for (int count = 0; count < num1.length(); count++) { for (int count = 0; count < num1.length(); count++) { for (int count = 0; count < num1.length(); count++) { for (int count = 0; count < num1.length(); count++) { for (int count = 0; count < num1.length(); count++) { for (int count = 0; count < num1.length(); count++) { for (int count = 0; count < num1.length(); count++) { for (int count = 0; count < num1.length(); count++) { for (int count = 0; count < num1.length(); count++) { for (int count = 0; count < num1.length(); count++) { for (int count = 0; count < num1.length(); count++) { for (int count = 0; count < num1.length(); count++) { for (int count = 0; count < num1.length(); count++) { for (int count = 0; count < num1.length(); count++) { for (int count = 0; count < num1.length(); count++) { for (int count = 0; count < num1.length(); count++) { for (int count = 0; count < num1.length(); count++) { for (int count = 0; count < num1.length(); count++) { for (int count = 0; count < num1.length(); count++) { for (int count = 0; count < num1.length(); count++) { for (int count = 0; count < num1.length(); count++) { for (int count = 0; count < num1.length(); count++) { for (int count = 0; count < num1.length(); count++) { for (int count = 0; count < num1.length(); count++) { for (int count = 0; count < num1.length(); count++) { for (int count = 0; count < num1.length(); count++) { for (int count = 0; count < num1.length(); count++) { num2 = num1.charAt(count); num2 = num1.charAt(count); num2 = num1.charAt(count); num2 = num1.charAt(count); num2 = num1.charAt(count); num2 = num1.charAt(count); num2 = num1.charAt(count); num2 = num1.charAt(count); num2 = num1.charAt(count); num2 = num1.charAt(count); num2 = num1.charAt(count); num2 = num1.charAt(count); num3 = Character. num3 = Character. num3 = Character. num3 = Character. num3 = Character. num3 = Character. num3 = Character.getNumericValue(num2);(num2);(num2);(num2); num4 = num4 + num3; num4 = num4 + num3; num4 = num4 + num3; num4 = num4 + num3; num4 = num4 + num3; num4 = num4 + num3; num4 = num4 + num3; num4 = num4 + num3; num4 = num4 + num3; num4 = num4 + num3; num4 = num4 + num3;

} } /* The code above takes the string and removes each individual character /* 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 from the string. Then turns it into an int, adds it with the sum of the 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 numbers before it, if no numbers before it adds with 0. It keeps doing numbers before it, if no numbers before it adds with 0. It keeps doing this till all numbers have been satisfied*/ this till all numbers have been satisfied*/

num5 = String. num5 = String. num5 = String. num5 = String. num5 = String. num5 = String. num5 = String.valueOf(num4);(num4);(num4);(num4);

for (int count = 0; count < num5.length(); count++) { for (int count = 0; count < num5.length(); count++) { for (int count = 0; count < num5.length(); count++) { for (int count = 0; count < num5.length(); count++) { for (int count = 0; count < num5.length(); count++) { for (int count = 0; count < num5.length(); count++) { for (int count = 0; count < num5.length(); count++) { for (int count = 0; count < num5.length(); count++) { for (int count = 0; count < num5.length(); count++) { for (int count = 0; count < num5.length(); count++) { for (int count = 0; count < num5.length(); count++) { for (int count = 0; count < num5.length(); count++) { for (int count = 0; count < num5.length(); count++) { for (int count = 0; count < num5.length(); count++) { for (int count = 0; count < num5.length(); count++) { for (int count = 0; count < num5.length(); count++) { for (int count = 0; count < num5.length(); count++) { for (int count = 0; count < num5.length(); count++) { for (int count = 0; count < num5.length(); count++) { for (int count = 0; count < num5.length(); count++) { for (int count = 0; count < num5.length(); count++) { for (int count = 0; count < num5.length(); count++) { for (int count = 0; count < num5.length(); count++) { for (int count = 0; count < num5.length(); count++) { for (int count = 0; count < num5.length(); count++) { for (int count = 0; count < num5.length(); count++) { for (int count = 0; count < num5.length(); count++) { for (int count = 0; count < num5.length(); count++) { for (int count = 0; count < num5.length(); count++) { num7 = num5.charAt(count); num7 = num5.charAt(count); num7 = num5.charAt(count); num7 = num5.charAt(count); num7 = num5.charAt(count); num7 = num5.charAt(count); num7 = num5.charAt(count); num7 = num5.charAt(count); num7 = num5.charAt(count); num7 = num5.charAt(count); num7 = num5.charAt(count); num7 = num5.charAt(count); num8 = Character. num8 = Character. num8 = Character. num8 = Character. num8 = Character. num8 = Character. num8 = Character.getNumericValue(num7);(num7);(num7);(num7); num6 = num6 + num8; num6 = num6 + num8; num6 = num6 + num8; num6 = num6 + num8; num6 = num6 + num8; num6 = num6 + num8; num6 = num6 + num8; num6 = num6 + num8; num6 = num6 + num8; num6 = num6 + num8; num6 = num6 + num8; } } System. System. System.out.println("Mey-Rin: 'Your lucky number is " + num6 + ".'");.println("Mey-Rin: 'Your lucky number is " + num6 + ".'");.println("Mey-Rin: 'Your lucky number is " + num6 + ".'");.println("Mey-Rin: 'Your lucky number is " + num6 + ".'");.println("Mey-Rin: 'Your lucky number is " + num6 + ".'");.println("Mey-Rin: 'Your lucky number is " + num6 + ".'");.println("Mey-Rin: 'Your lucky number is " + num6 + ".'");.println("Mey-Rin: 'Your lucky number is " + num6 + ".'");.println("Mey-Rin: 'Your lucky number is " + num6 + ".'");.println("Mey-Rin: 'Your lucky number is " + num6 + ".'");.println("Mey-Rin: 'Your lucky number is " + num6 + ".'");.println("Mey-Rin: 'Your lucky number is " + num6 + ".'");.println("Mey-Rin: 'Your lucky number is " + num6 + ".'");.println("Mey-Rin: 'Your lucky number is " + num6 + ".'");.println("Mey-Rin: 'Your lucky number is " + num6 + ".'");.println("Mey-Rin: 'Your lucky number is " + num6 + ".'");.println("Mey-Rin: 'Your lucky number is " + num6 + ".'");.println("Mey-Rin: 'Your lucky number is " + num6 + ".'"); } }}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/luckyNumber.java

1.1 of 1 2014.12.03 13:48:47

Page 45: Text adventure

1234567891011121314151617

19202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class methods { {

public static void public static void public static void public static void public static void public static void public static void methodKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in););

int assassins = 0, scan; int assassins = 0, scan; int assassins = 0, scan; int assassins = 0, scan; int assassins = 0, scan; int assassins = 0, scan; int assassins = 0, scan; int assassins = 0, scan; int assassins = 0, scan; int assassins = 0, scan; int assassins = 0, scan; int assassins = 0, scan;

System. System. System.out.println("You walk up to the dark brotherhood and a man stops".println("You walk up to the dark brotherhood and a man stops".println("You walk up to the dark brotherhood and a man stops".println("You walk up to the dark brotherhood and a man stops".println("You walk up to the dark brotherhood and a man stops".println("You walk up to the dark brotherhood and a man stops" + " you"); + " you"); + " you"); + " you"); + " you"); + " you"); + " you"); + " you"); System. System. System.out.println("Assassin: 'Why have you come here'");.println("Assassin: 'Why have you come here'");.println("Assassin: 'Why have you come here'");.println("Assassin: 'Why have you come here'");.println("Assassin: 'Why have you come here'");.println("Assassin: 'Why have you come here'");.println("Assassin: 'Why have you come here'");.println("Assassin: 'Why have you come here'"); System. System. System.out.println("You tell him you're here just to check things out a".println("You tell him you're here just to check things out a".println("You tell him you're here just to check things out a".println("You tell him you're here just to check things out a".println("You tell him you're here just to check things out a".println("You tell him you're here just to check things out a" + "nd help if you can."); + "nd help if you can."); + "nd help if you can."); + "nd help if you can."); + "nd help if you can."); + "nd help if you can."); + "nd help if you can."); + "nd help if you can."); System. System. System.out.println("Assassin: 'Oh you're the replacement, wonderful com".println("Assassin: 'Oh you're the replacement, wonderful com".println("Assassin: 'Oh you're the replacement, wonderful com".println("Assassin: 'Oh you're the replacement, wonderful com".println("Assassin: 'Oh you're the replacement, wonderful com".println("Assassin: 'Oh you're the replacement, wonderful com" + "e along'"); + "e along'"); + "e along'"); + "e along'"); + "e along'"); + "e along'"); + "e along'"); + "e along'"); System. System. System.out.println("The assassin brings you and sits you down at a desk".println("The assassin brings you and sits you down at a desk".println("The assassin brings you and sits you down at a desk".println("The assassin brings you and sits you down at a desk".println("The assassin brings you and sits you down at a desk".println("The assassin brings you and sits you down at a desk" + "."); + "."); + "."); + "."); + "."); + "."); + "."); + "."); System. System. System.out.println("Assassin: 'there is some business thats need to be ".println("Assassin: 'there is some business thats need to be ".println("Assassin: 'there is some business thats need to be ".println("Assassin: 'there is some business thats need to be ".println("Assassin: 'there is some business thats need to be ".println("Assassin: 'there is some business thats need to be " + "taken care of, take care of it.'"); + "taken care of, take care of it.'"); + "taken care of, take care of it.'"); + "taken care of, take care of it.'"); + "taken care of, take care of it.'"); + "taken care of, take care of it.'"); + "taken care of, take care of it.'"); + "taken care of, take care of it.'"); System. System. System.out.println("You see three folders on the desk, one talks about ".println("You see three folders on the desk, one talks about ".println("You see three folders on the desk, one talks about ".println("You see three folders on the desk, one talks about ".println("You see three folders on the desk, one talks about ".println("You see three folders on the desk, one talks about " + "finding roots, the other talks about division"); + "finding roots, the other talks about division"); + "finding roots, the other talks about division"); + "finding roots, the other talks about division"); + "finding roots, the other talks about division"); + "finding roots, the other talks about division"); + "finding roots, the other talks about division"); + "finding roots, the other talks about division"); System. System. System.out.println("the last talks of circles.");.println("the last talks of circles.");.println("the last talks of circles.");.println("the last talks of circles.");.println("the last talks of circles.");.println("the last talks of circles.");.println("the last talks of circles.");.println("the last talks of circles."); while (assassins != 4) { while (assassins != 4) { while (assassins != 4) { while (assassins != 4) { while (assassins != 4) { while (assassins != 4) { while (assassins != 4) { while (assassins != 4) { while (assassins != 4) { while (assassins != 4) { while (assassins != 4) { while (assassins != 4) { scan = 0; // reset scan at the beginning of the loop scan = 0; // reset scan at the beginning of the loop scan = 0; // reset scan at the beginning of the loop scan = 0; // reset scan at the beginning of the loop scan = 0; // reset scan at the beginning of the loop scan = 0; // reset scan at the beginning of the loop scan = 0; // reset scan at the beginning of the loop scan = 0; // reset scan at the beginning of the loop scan = 0; // reset scan at the beginning of the loop System. System. System.out.println("Do you want to 1: Do the job about roots, 2:".println("Do you want to 1: Do the job about roots, 2:".println("Do you want to 1: Do the job about roots, 2:".println("Do you want to 1: Do the job about roots, 2:".println("Do you want to 1: Do the job about roots, 2:".println("Do you want to 1: Do the job about roots, 2:" + " divison, 3: circles, or " + " divison, 3: circles, or " + " divison, 3: circles, or " + " divison, 3: circles, or " + " divison, 3: circles, or " + " divison, 3: circles, or " + "4: leave?"); + "4: leave?"); + "4: leave?"); + "4: leave?"); + "4: leave?"); + "4: leave?"); + "4: leave?"); + "4: leave?"); assassins = in.nextInt(); assassins = in.nextInt(); assassins = in.nextInt(); assassins = in.nextInt(); assassins = in.nextInt(); assassins = in.nextInt(); assassins = in.nextInt(); assassins = in.nextInt(); assassins = in.nextInt(); assassins = in.nextInt(); assassins = in.nextInt(); switch (assassins) { switch (assassins) { switch (assassins) { switch (assassins) { switch (assassins) { switch (assassins) { switch (assassins) { switch (assassins) { case 1: case 1: case 1: case 1: case 1: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { System. System. System.out.println("You walk into a dark room where".println("You walk into a dark room where".println("You walk into a dark room where".println("You walk into a dark room where".println("You walk into a dark room where".println("You walk into a dark room where" + " a man is chained up on the floor"); + " a man is chained up on the floor"); + " a man is chained up on the floor"); + " a man is chained up on the floor"); + " a man is chained up on the floor"); + " a man is chained up on the floor"); + " a man is chained up on the floor"); + " a man is chained up on the floor"); System. System. System.out.println("Assassin: 'We are training him ".println("Assassin: 'We are training him ".println("Assassin: 'We are training him ".println("Assassin: 'We are training him ".println("Assassin: 'We are training him ".println("Assassin: 'We are training him " + "to be an assassin, he must be smart, ask" + "to be an assassin, he must be smart, ask" + "to be an assassin, he must be smart, ask" + "to be an assassin, he must be smart, ask" + "to be an assassin, he must be smart, ask" + "to be an assassin, he must be smart, ask" + " him to give the square root of a number" + " him to give the square root of a number" + " him to give the square root of a number" + " him to give the square root of a number" + " him to give the square root of a number" + " him to give the square root of a number" + "'"); + "'"); + "'"); + "'"); + "'"); + "'"); + "'"); + "'"); squareRootM. squareRootM. squareRootM.squareRootMKing();();(); System. System. System.out.println("You leave the room, very confus".println("You leave the room, very confus".println("You leave the room, very confus".println("You leave the room, very confus".println("You leave the room, very confus".println("You leave the room, very confus" + "ed."); + "ed."); + "ed."); + "ed."); + "ed."); + "ed."); + "ed."); + "ed."); scan++; scan++; scan++; scan++; scan++; } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number"); } } } } break; break; break; case 2: case 2: case 2: case 2: case 2: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { System. System. System.out.println("You enter a room and within it ".println("You enter a room and within it ".println("You enter a room and within it ".println("You enter a room and within it ".println("You enter a room and within it ".println("You enter a room and within it " + "you find an assassin pondering over a co" + "you find an assassin pondering over a co" + "you find an assassin pondering over a co" + "you find an assassin pondering over a co" + "you find an assassin pondering over a co" + "you find an assassin pondering over a co" + "mputer"); + "mputer"); + "mputer"); + "mputer"); + "mputer"); + "mputer"); + "mputer"); + "mputer"); System. System. System.out.println("Assassin: 'Oh good, you're here".println("Assassin: 'Oh good, you're here".println("Assassin: 'Oh good, you're here".println("Assassin: 'Oh good, you're here".println("Assassin: 'Oh good, you're here".println("Assassin: 'Oh good, you're here" + ", I need help. I need to find if two peo" + ", I need help. I need to find if two peo" + ", I need help. I need to find if two peo" + ", I need help. I need to find if two peo" + ", I need help. I need to find if two peo" + ", I need help. I need to find if two peo" + "ple are related"); + "ple are related"); + "ple are related"); + "ple are related"); + "ple are related"); + "ple are related"); + "ple are related"); + "ple are related"); System. System. System.out.println("Assassin: 'We give all out targ".println("Assassin: 'We give all out targ".println("Assassin: 'We give all out targ".println("Assassin: 'We give all out targ".println("Assassin: 'We give all out targ".println("Assassin: 'We give all out targ" + "ets numbers and if the numbers divide ev" + "ets numbers and if the numbers divide ev" + "ets numbers and if the numbers divide ev" + "ets numbers and if the numbers divide ev" + "ets numbers and if the numbers divide ev" + "ets numbers and if the numbers divide ev" + "enly, they are related."); + "enly, they are related."); + "enly, they are related."); + "enly, they are related."); + "enly, they are related."); + "enly, they are related."); + "enly, they are related."); + "enly, they are related.");

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/methods.java

1.1 of 2 2014.12.03 15:21:56

Page 46: Text adventure

737475767778798081828384858687888990919293949596979899100101102103104105106107

+ "enly, they are related."); + "enly, they are related."); + "enly, they are related."); + "enly, they are related."); + "enly, they are related."); + "enly, they are related."); + "enly, they are related."); + "enly, they are related."); multipleOrNot. multipleOrNot. multipleOrNot.multipleOrNotKing();();(); System. System. System.out.println("You leave wondering if you've j".println("You leave wondering if you've j".println("You leave wondering if you've j".println("You leave wondering if you've j".println("You leave wondering if you've j".println("You leave wondering if you've j" + "ust saved a life."); + "ust saved a life."); + "ust saved a life."); + "ust saved a life."); + "ust saved a life."); + "ust saved a life."); + "ust saved a life."); + "ust saved a life."); scan++; scan++; scan++; scan++; scan++; } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Pleas enter a number!");.println("Pleas enter a number!");.println("Pleas enter a number!");.println("Pleas enter a number!");.println("Pleas enter a number!");.println("Pleas enter a number!");.println("Pleas enter a number!");.println("Pleas enter a number!"); } } } } break; break; break; case 3: case 3: case 3: case 3: case 3: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { System. System. System.out.println("You enter a room and see a man ".println("You enter a room and see a man ".println("You enter a room and see a man ".println("You enter a room and see a man ".println("You enter a room and see a man ".println("You enter a room and see a man " + "being interrogated by an assassin."); + "being interrogated by an assassin."); + "being interrogated by an assassin."); + "being interrogated by an assassin."); + "being interrogated by an assassin."); + "being interrogated by an assassin."); + "being interrogated by an assassin."); + "being interrogated by an assassin."); System. System. System.out.println("Assassin: 'Oh good, I require y".println("Assassin: 'Oh good, I require y".println("Assassin: 'Oh good, I require y".println("Assassin: 'Oh good, I require y".println("Assassin: 'Oh good, I require y".println("Assassin: 'Oh good, I require y" + "our help, we need to make sure this man " + "our help, we need to make sure this man " + "our help, we need to make sure this man " + "our help, we need to make sure this man " + "our help, we need to make sure this man " + "our help, we need to make sure this man " + "is still mentally able, ask him to "); + "is still mentally able, ask him to "); + "is still mentally able, ask him to "); + "is still mentally able, ask him to "); + "is still mentally able, ask him to "); + "is still mentally able, ask him to "); + "is still mentally able, ask him to "); + "is still mentally able, ask him to "); System. System. System.out.println("find the area of a circle.'");.println("find the area of a circle.'");.println("find the area of a circle.'");.println("find the area of a circle.'");.println("find the area of a circle.'");.println("find the area of a circle.'");.println("find the area of a circle.'");.println("find the area of a circle.'"); areaOfCircle. areaOfCircle. areaOfCircle.areaOfCircleKing();();(); System. System. System.out.println("Assassin: 'It seems he is still".println("Assassin: 'It seems he is still".println("Assassin: 'It seems he is still".println("Assassin: 'It seems he is still".println("Assassin: 'It seems he is still".println("Assassin: 'It seems he is still" + " coherent, thank you friend.'"); + " coherent, thank you friend.'"); + " coherent, thank you friend.'"); + " coherent, thank you friend.'"); + " coherent, thank you friend.'"); + " coherent, thank you friend.'"); + " coherent, thank you friend.'"); + " coherent, thank you friend.'"); System. System. System.out.println("You leave the room wondering if".println("You leave the room wondering if".println("You leave the room wondering if".println("You leave the room wondering if".println("You leave the room wondering if".println("You leave the room wondering if" + " you just killed someone."); + " you just killed someone."); + " you just killed someone."); + " you just killed someone."); + " you just killed someone."); + " you just killed someone."); + " you just killed someone."); + " you just killed someone."); scan++; scan++; scan++; scan++; scan++; } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Pleas enter a number!");.println("Pleas enter a number!");.println("Pleas enter a number!");.println("Pleas enter a number!");.println("Pleas enter a number!");.println("Pleas enter a number!");.println("Pleas enter a number!");.println("Pleas enter a number!"); } } } } break; break; break; } } } } } }}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/methods.java

2.1 of 2 2014.12.03 15:21:56

Page 47: Text adventure

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class misc { {

public static void public static void public static void public static void public static void public static void public static void miscKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in);); int scan, miscChoice = 0; int scan, miscChoice = 0; int scan, miscChoice = 0; int scan, miscChoice = 0; int scan, miscChoice = 0; int scan, miscChoice = 0; int scan, miscChoice = 0; int scan, miscChoice = 0; int scan, miscChoice = 0; int scan, miscChoice = 0; int scan, miscChoice = 0; int scan, miscChoice = 0;

System. System. System.out.println("You walk down the street and come to a giant ca".println("You walk down the street and come to a giant ca".println("You walk down the street and come to a giant ca".println("You walk down the street and come to a giant ca".println("You walk down the street and come to a giant ca".println("You walk down the street and come to a giant ca" + "stle, the sign says 'Phantomhive residence'"); + "stle, the sign says 'Phantomhive residence'"); + "stle, the sign says 'Phantomhive residence'"); + "stle, the sign says 'Phantomhive residence'"); + "stle, the sign says 'Phantomhive residence'"); + "stle, the sign says 'Phantomhive residence'"); + "stle, the sign says 'Phantomhive residence'"); + "stle, the sign says 'Phantomhive residence'"); System. System. System.out.println("You get greeted by a tall thin man in a black t".println("You get greeted by a tall thin man in a black t".println("You get greeted by a tall thin man in a black t".println("You get greeted by a tall thin man in a black t".println("You get greeted by a tall thin man in a black t".println("You get greeted by a tall thin man in a black t" + "ux."); + "ux."); + "ux."); + "ux."); + "ux."); + "ux."); + "ux."); + "ux."); System. System. System.out.println("Sebastien: 'Hello, I am the butler and servent ".println("Sebastien: 'Hello, I am the butler and servent ".println("Sebastien: 'Hello, I am the butler and servent ".println("Sebastien: 'Hello, I am the butler and servent ".println("Sebastien: 'Hello, I am the butler and servent ".println("Sebastien: 'Hello, I am the butler and servent " + "to my young master Ciel.'"); + "to my young master Ciel.'"); + "to my young master Ciel.'"); + "to my young master Ciel.'"); + "to my young master Ciel.'"); + "to my young master Ciel.'"); + "to my young master Ciel.'"); + "to my young master Ciel.'"); System. System. System.out.println("Sebastien: 'Ciel is busy today but we could use".println("Sebastien: 'Ciel is busy today but we could use".println("Sebastien: 'Ciel is busy today but we could use".println("Sebastien: 'Ciel is busy today but we could use".println("Sebastien: 'Ciel is busy today but we could use".println("Sebastien: 'Ciel is busy today but we could use" + " some help, the other butlers are quite incompitent.'"); + " some help, the other butlers are quite incompitent.'"); + " some help, the other butlers are quite incompitent.'"); + " some help, the other butlers are quite incompitent.'"); + " some help, the other butlers are quite incompitent.'"); + " some help, the other butlers are quite incompitent.'"); + " some help, the other butlers are quite incompitent.'"); + " some help, the other butlers are quite incompitent.'"); System. System. System.out.println("Sebastien: 'Finnian needs help drawing a circle".println("Sebastien: 'Finnian needs help drawing a circle".println("Sebastien: 'Finnian needs help drawing a circle".println("Sebastien: 'Finnian needs help drawing a circle".println("Sebastien: 'Finnian needs help drawing a circle".println("Sebastien: 'Finnian needs help drawing a circle" + ".'"); + ".'"); + ".'"); + ".'"); + ".'"); + ".'"); + ".'"); + ".'"); System. System. System.out.println("Sebastien: 'Baldroy needs help with master Ciel".println("Sebastien: 'Baldroy needs help with master Ciel".println("Sebastien: 'Baldroy needs help with master Ciel".println("Sebastien: 'Baldroy needs help with master Ciel".println("Sebastien: 'Baldroy needs help with master Ciel".println("Sebastien: 'Baldroy needs help with master Ciel" + "'s math homework.'"); + "'s math homework.'"); + "'s math homework.'"); + "'s math homework.'"); + "'s math homework.'"); + "'s math homework.'"); + "'s math homework.'"); + "'s math homework.'"); System. System. System.out.println("Sebastien: 'May-Rin needs some help teling... f".println("Sebastien: 'May-Rin needs some help teling... f".println("Sebastien: 'May-Rin needs some help teling... f".println("Sebastien: 'May-Rin needs some help teling... f".println("Sebastien: 'May-Rin needs some help teling... f".println("Sebastien: 'May-Rin needs some help teling... f" + "ortunes, i sware I just need to do everything around her" + "ortunes, i sware I just need to do everything around her" + "ortunes, i sware I just need to do everything around her" + "ortunes, i sware I just need to do everything around her" + "ortunes, i sware I just need to do everything around her" + "ortunes, i sware I just need to do everything around her" + "e.'"); + "e.'"); + "e.'"); + "e.'"); + "e.'"); + "e.'"); + "e.'"); + "e.'"); while (miscChoice != 4) { while (miscChoice != 4) { while (miscChoice != 4) { while (miscChoice != 4) { while (miscChoice != 4) { while (miscChoice != 4) { while (miscChoice != 4) { while (miscChoice != 4) { while (miscChoice != 4) { while (miscChoice != 4) { while (miscChoice != 4) { while (miscChoice != 4) { scan = 0; scan = 0; scan = 0; scan = 0; scan = 0; scan = 0; scan = 0; System. System. System.out.println("Choose 1: Drawing circles, 2: math homework ".println("Choose 1: Drawing circles, 2: math homework ".println("Choose 1: Drawing circles, 2: math homework ".println("Choose 1: Drawing circles, 2: math homework ".println("Choose 1: Drawing circles, 2: math homework ".println("Choose 1: Drawing circles, 2: math homework " + "3: fortune telling or 4: leave"); + "3: fortune telling or 4: leave"); + "3: fortune telling or 4: leave"); + "3: fortune telling or 4: leave"); + "3: fortune telling or 4: leave"); + "3: fortune telling or 4: leave"); + "3: fortune telling or 4: leave"); + "3: fortune telling or 4: leave"); miscChoice = in.nextInt(); miscChoice = in.nextInt(); miscChoice = in.nextInt(); miscChoice = in.nextInt(); miscChoice = in.nextInt(); miscChoice = in.nextInt(); miscChoice = in.nextInt(); miscChoice = in.nextInt(); miscChoice = in.nextInt(); miscChoice = in.nextInt(); miscChoice = in.nextInt(); switch (miscChoice) { switch (miscChoice) { switch (miscChoice) { switch (miscChoice) { switch (miscChoice) { switch (miscChoice) { switch (miscChoice) { switch (miscChoice) { case 1: case 1: case 1: case 1: case 1: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { System. System. System.out.println("You open a door and find papers".println("You open a door and find papers".println("You open a door and find papers".println("You open a door and find papers".println("You open a door and find papers".println("You open a door and find papers" + " thrown all over the place and Finnian c" + " thrown all over the place and Finnian c" + " thrown all over the place and Finnian c" + " thrown all over the place and Finnian c" + " thrown all over the place and Finnian c" + " thrown all over the place and Finnian c" + "rying in the middle of them."); + "rying in the middle of them."); + "rying in the middle of them."); + "rying in the middle of them."); + "rying in the middle of them."); + "rying in the middle of them."); + "rying in the middle of them."); + "rying in the middle of them."); System. System. System.out.println("Finnian: 'oh thank god your her".println("Finnian: 'oh thank god your her".println("Finnian: 'oh thank god your her".println("Finnian: 'oh thank god your her".println("Finnian: 'oh thank god your her".println("Finnian: 'oh thank god your her" + "e! I need help, I need to finish this pr" + "e! I need help, I need to finish this pr" + "e! I need help, I need to finish this pr" + "e! I need help, I need to finish this pr" + "e! I need help, I need to finish this pr" + "e! I need help, I need to finish this pr" + "oject now or master sebastien will be ju" + "oject now or master sebastien will be ju" + "oject now or master sebastien will be ju" + "oject now or master sebastien will be ju" + "oject now or master sebastien will be ju" + "oject now or master sebastien will be ju" + "st furious with me.'"); + "st furious with me.'"); + "st furious with me.'"); + "st furious with me.'"); + "st furious with me.'"); + "st furious with me.'"); + "st furious with me.'"); + "st furious with me.'"); System. System. System.out.println("Finnian: 'you you please help m".println("Finnian: 'you you please help m".println("Finnian: 'you you please help m".println("Finnian: 'you you please help m".println("Finnian: 'you you please help m".println("Finnian: 'you you please help m" + "e!'"); + "e!'"); + "e!'"); + "e!'"); + "e!'"); + "e!'"); + "e!'"); + "e!'"); System. System. System.out.println("You nod.");.println("You nod.");.println("You nod.");.println("You nod.");.println("You nod.");.println("You nod.");.println("You nod.");.println("You nod."); System. System. System.out.println("Finnian: 'oh thank you, you're ".println("Finnian: 'oh thank you, you're ".println("Finnian: 'oh thank you, you're ".println("Finnian: 'oh thank you, you're ".println("Finnian: 'oh thank you, you're ".println("Finnian: 'oh thank you, you're " + "the best! So I need to draw 1/4 of a cir" + "the best! So I need to draw 1/4 of a cir" + "the best! So I need to draw 1/4 of a cir" + "the best! So I need to draw 1/4 of a cir" + "the best! So I need to draw 1/4 of a cir" + "the best! So I need to draw 1/4 of a cir" + "cle in a quadrant but I can't decide whi" + "cle in a quadrant but I can't decide whi" + "cle in a quadrant but I can't decide whi" + "cle in a quadrant but I can't decide whi" + "cle in a quadrant but I can't decide whi" + "cle in a quadrant but I can't decide whi" + "ch quadrant to draw it in!"); + "ch quadrant to draw it in!"); + "ch quadrant to draw it in!"); + "ch quadrant to draw it in!"); + "ch quadrant to draw it in!"); + "ch quadrant to draw it in!"); + "ch quadrant to draw it in!"); + "ch quadrant to draw it in!"); quadOfAngle. quadOfAngle. quadOfAngle.quadOfAngleKing();();(); System. System. System.out.println("He is busy drawing and forgets ".println("He is busy drawing and forgets ".println("He is busy drawing and forgets ".println("He is busy drawing and forgets ".println("He is busy drawing and forgets ".println("He is busy drawing and forgets " + "that you exist, you leave the room."); + "that you exist, you leave the room."); + "that you exist, you leave the room."); + "that you exist, you leave the room."); + "that you exist, you leave the room."); + "that you exist, you leave the room."); + "that you exist, you leave the room."); + "that you exist, you leave the room."); scan++;//kills loop scan++;//kills loop scan++;//kills loop scan++;//kills loop scan++;//kills loop } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number"); } } } } break; break; break; case 2: case 2: case 2: case 2: case 2: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { System. System. System.out.println("You walk into a room and see Ba".println("You walk into a room and see Ba".println("You walk into a room and see Ba".println("You walk into a room and see Ba".println("You walk into a room and see Ba".println("You walk into a room and see Ba" + "ldroy sititng at a desk next to a white " + "ldroy sititng at a desk next to a white " + "ldroy sititng at a desk next to a white " + "ldroy sititng at a desk next to a white " + "ldroy sititng at a desk next to a white " + "ldroy sititng at a desk next to a white "

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/misc.java

1.1 of 2 2014.12.03 14:22:11

Page 48: Text adventure

737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127

+ "ldroy sititng at a desk next to a white " + "ldroy sititng at a desk next to a white " + "ldroy sititng at a desk next to a white " + "ldroy sititng at a desk next to a white " + "ldroy sititng at a desk next to a white " + "ldroy sititng at a desk next to a white " + "board filled with equations."); + "board filled with equations."); + "board filled with equations."); + "board filled with equations."); + "board filled with equations."); + "board filled with equations."); + "board filled with equations."); + "board filled with equations."); System. System. System.out.println("Baldroy: 'Gah, I just can't fig".println("Baldroy: 'Gah, I just can't fig".println("Baldroy: 'Gah, I just can't fig".println("Baldroy: 'Gah, I just can't fig".println("Baldroy: 'Gah, I just can't fig".println("Baldroy: 'Gah, I just can't fig" + "gure this problem out!'"); + "gure this problem out!'"); + "gure this problem out!'"); + "gure this problem out!'"); + "gure this problem out!'"); + "gure this problem out!'"); + "gure this problem out!'"); + "gure this problem out!'"); System. System. System.out.println("He notices you");.println("He notices you");.println("He notices you");.println("He notices you");.println("He notices you");.println("He notices you");.println("He notices you");.println("He notices you"); System. System. System.out.println("Baldroy: 'Oh good sebastien sen".println("Baldroy: 'Oh good sebastien sen".println("Baldroy: 'Oh good sebastien sen".println("Baldroy: 'Oh good sebastien sen".println("Baldroy: 'Oh good sebastien sen".println("Baldroy: 'Oh good sebastien sen" + "t help! MATE! Over here I need ya!"); + "t help! MATE! Over here I need ya!"); + "t help! MATE! Over here I need ya!"); + "t help! MATE! Over here I need ya!"); + "t help! MATE! Over here I need ya!"); + "t help! MATE! Over here I need ya!"); + "t help! MATE! Over here I need ya!"); + "t help! MATE! Over here I need ya!"); System. System. System.out.println("You walk over slowly and ask wh".println("You walk over slowly and ask wh".println("You walk over slowly and ask wh".println("You walk over slowly and ask wh".println("You walk over slowly and ask wh".println("You walk over slowly and ask wh" + "at the problem is"); + "at the problem is"); + "at the problem is"); + "at the problem is"); + "at the problem is"); + "at the problem is"); + "at the problem is"); + "at the problem is"); System. System. System.out.println("Baldroy: 'I just can't do work ".println("Baldroy: 'I just can't do work ".println("Baldroy: 'I just can't do work ".println("Baldroy: 'I just can't do work ".println("Baldroy: 'I just can't do work ".println("Baldroy: 'I just can't do work " + "alone, I need you to help me out!"); + "alone, I need you to help me out!"); + "alone, I need you to help me out!"); + "alone, I need you to help me out!"); + "alone, I need you to help me out!"); + "alone, I need you to help me out!"); + "alone, I need you to help me out!"); + "alone, I need you to help me out!"); System. System. System.out.println("Baldroy: 'I gotta multiply matr".println("Baldroy: 'I gotta multiply matr".println("Baldroy: 'I gotta multiply matr".println("Baldroy: 'I gotta multiply matr".println("Baldroy: 'I gotta multiply matr".println("Baldroy: 'I gotta multiply matr" + "icies together but I'm not sure if I rem" + "icies together but I'm not sure if I rem" + "icies together but I'm not sure if I rem" + "icies together but I'm not sure if I rem" + "icies together but I'm not sure if I rem" + "icies together but I'm not sure if I rem" + "ember how."); + "ember how."); + "ember how."); + "ember how."); + "ember how."); + "ember how."); + "ember how."); + "ember how."); System. System. System.out.println("Baldroy: 'Could you give me two".println("Baldroy: 'Could you give me two".println("Baldroy: 'Could you give me two".println("Baldroy: 'Could you give me two".println("Baldroy: 'Could you give me two".println("Baldroy: 'Could you give me two" + " matricies and I'll see if I remeber.'"); + " matricies and I'll see if I remeber.'"); + " matricies and I'll see if I remeber.'"); + " matricies and I'll see if I remeber.'"); + " matricies and I'll see if I remeber.'"); + " matricies and I'll see if I remeber.'"); + " matricies and I'll see if I remeber.'"); + " matricies and I'll see if I remeber.'"); multiplyMatricies. multiplyMatricies. multiplyMatricies.multiplyMatriciesKing();();(); System. System. System.out.println("Feeling good about helping out ".println("Feeling good about helping out ".println("Feeling good about helping out ".println("Feeling good about helping out ".println("Feeling good about helping out ".println("Feeling good about helping out " + "you leave in a better mood."); + "you leave in a better mood."); + "you leave in a better mood."); + "you leave in a better mood."); + "you leave in a better mood."); + "you leave in a better mood."); + "you leave in a better mood."); + "you leave in a better mood."); scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number"); } } } } break; break; break; case 3: case 3: case 3: case 3: case 3: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { System. System. System.out.println("You walk into a room filled wit".println("You walk into a room filled wit".println("You walk into a room filled wit".println("You walk into a room filled wit".println("You walk into a room filled wit".println("You walk into a room filled wit" + "h pentagrams and symbols drawn across th" + "h pentagrams and symbols drawn across th" + "h pentagrams and symbols drawn across th" + "h pentagrams and symbols drawn across th" + "h pentagrams and symbols drawn across th" + "h pentagrams and symbols drawn across th" + "e room."); + "e room."); + "e room."); + "e room."); + "e room."); + "e room."); + "e room."); + "e room."); System. System. System.out.println("Mey-Rin: 'Oh good! A new custom".println("Mey-Rin: 'Oh good! A new custom".println("Mey-Rin: 'Oh good! A new custom".println("Mey-Rin: 'Oh good! A new custom".println("Mey-Rin: 'Oh good! A new custom".println("Mey-Rin: 'Oh good! A new custom" + "er it is, it is.'"); + "er it is, it is.'"); + "er it is, it is.'"); + "er it is, it is.'"); + "er it is, it is.'"); + "er it is, it is.'"); + "er it is, it is.'"); + "er it is, it is.'"); System. System. System.out.println("Mey-Rin: 'I can tell your fortu".println("Mey-Rin: 'I can tell your fortu".println("Mey-Rin: 'I can tell your fortu".println("Mey-Rin: 'I can tell your fortu".println("Mey-Rin: 'I can tell your fortu".println("Mey-Rin: 'I can tell your fortu" + "ne I can, I can."); + "ne I can, I can."); + "ne I can, I can."); + "ne I can, I can."); + "ne I can, I can."); + "ne I can, I can."); + "ne I can, I can."); + "ne I can, I can."); System. System. System.out.println("Mey-Rin: 'What's your birthday?".println("Mey-Rin: 'What's your birthday?".println("Mey-Rin: 'What's your birthday?".println("Mey-Rin: 'What's your birthday?".println("Mey-Rin: 'What's your birthday?".println("Mey-Rin: 'What's your birthday?" + " Tell me and I'll give you a lucky numbe" + " Tell me and I'll give you a lucky numbe" + " Tell me and I'll give you a lucky numbe" + " Tell me and I'll give you a lucky numbe" + " Tell me and I'll give you a lucky numbe" + " Tell me and I'll give you a lucky numbe" + "r I will, I will."); + "r I will, I will."); + "r I will, I will."); + "r I will, I will."); + "r I will, I will."); + "r I will, I will."); + "r I will, I will."); + "r I will, I will."); luckyNumber. luckyNumber. luckyNumber.luckyNumberKing();();(); System. System. System.out.println("Mey-Rin: 'Oh that's a good numb".println("Mey-Rin: 'Oh that's a good numb".println("Mey-Rin: 'Oh that's a good numb".println("Mey-Rin: 'Oh that's a good numb".println("Mey-Rin: 'Oh that's a good numb".println("Mey-Rin: 'Oh that's a good numb" + "er it is, it is."); + "er it is, it is."); + "er it is, it is."); + "er it is, it is."); + "er it is, it is."); + "er it is, it is."); + "er it is, it is."); + "er it is, it is."); System. System. System.out.println("You leave hurriedly.");.println("You leave hurriedly.");.println("You leave hurriedly.");.println("You leave hurriedly.");.println("You leave hurriedly.");.println("You leave hurriedly.");.println("You leave hurriedly.");.println("You leave hurriedly."); scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number"); } } } } break; break; break; } } } }

} }

}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/misc.java

2.1 of 2 2014.12.03 14:22:11

Page 49: Text adventure

1234567891011121314151617181920212223242526272829303132

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class multipleMultiplication { {

public static void public static void public static void public static void public static void public static void public static void multipleMultiplicationKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in); // in because patterns); // in because patterns); // in because patterns); // in because patterns int answer; int answer; int answer; int answer; int answer;

System. System. System.out.println("Give the dragon a number:");.println("Give the dragon a number:");.println("Give the dragon a number:");.println("Give the dragon a number:");.println("Give the dragon a number:");.println("Give the dragon a number:");.println("Give the dragon a number:");.println("Give the dragon a number:"); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); System. System. System.out.println("Give the dragon a number of multiples:");.println("Give the dragon a number of multiples:");.println("Give the dragon a number of multiples:");.println("Give the dragon a number of multiples:");.println("Give the dragon a number of multiples:");.println("Give the dragon a number of multiples:");.println("Give the dragon a number of multiples:");.println("Give the dragon a number of multiples:"); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); for (int num3 = 1; num3 <= num2; num3++) { for (int num3 = 1; num3 <= num2; num3++) { for (int num3 = 1; num3 <= num2; num3++) { for (int num3 = 1; num3 <= num2; num3++) { for (int num3 = 1; num3 <= num2; num3++) { for (int num3 = 1; num3 <= num2; num3++) { for (int num3 = 1; num3 <= num2; num3++) { for (int num3 = 1; num3 <= num2; num3++) { for (int num3 = 1; num3 <= num2; num3++) { for (int num3 = 1; num3 <= num2; num3++) { for (int num3 = 1; num3 <= num2; num3++) { for (int num3 = 1; num3 <= num2; num3++) { for (int num3 = 1; num3 <= num2; num3++) { for (int num3 = 1; num3 <= num2; num3++) { for (int num3 = 1; num3 <= num2; num3++) { for (int num3 = 1; num3 <= num2; num3++) { for (int num3 = 1; num3 <= num2; num3++) { for (int num3 = 1; num3 <= num2; num3++) { for (int num3 = 1; num3 <= num2; num3++) { for (int num3 = 1; num3 <= num2; num3++) { for (int num3 = 1; num3 <= num2; num3++) { for (int num3 = 1; num3 <= num2; num3++) { for (int num3 = 1; num3 <= num2; num3++) { for (int num3 = 1; num3 <= num2; num3++) { for (int num3 = 1; num3 <= num2; num3++) { answer = num1 * num3; //multiplies them all together, yay. answer = num1 * num3; //multiplies them all together, yay. answer = num1 * num3; //multiplies them all together, yay. answer = num1 * num3; //multiplies them all together, yay. answer = num1 * num3; //multiplies them all together, yay. answer = num1 * num3; //multiplies them all together, yay. answer = num1 * num3; //multiplies them all together, yay. answer = num1 * num3; //multiplies them all together, yay. answer = num1 * num3; //multiplies them all together, yay. answer = num1 * num3; //multiplies them all together, yay. answer = num1 * num3; //multiplies them all together, yay. answer = num1 * num3; //multiplies them all together, yay. answer = num1 * num3; //multiplies them all together, yay. System. System. System.out.println("Dragon: " + num1 + "*" + num3 + "=" + answer);.println("Dragon: " + num1 + "*" + num3 + "=" + answer);.println("Dragon: " + num1 + "*" + num3 + "=" + answer);.println("Dragon: " + num1 + "*" + num3 + "=" + answer);.println("Dragon: " + num1 + "*" + num3 + "=" + answer);.println("Dragon: " + num1 + "*" + num3 + "=" + answer);.println("Dragon: " + num1 + "*" + num3 + "=" + answer);.println("Dragon: " + num1 + "*" + num3 + "=" + answer);.println("Dragon: " + num1 + "*" + num3 + "=" + answer);.println("Dragon: " + num1 + "*" + num3 + "=" + answer);.println("Dragon: " + num1 + "*" + num3 + "=" + answer);.println("Dragon: " + num1 + "*" + num3 + "=" + answer);.println("Dragon: " + num1 + "*" + num3 + "=" + answer);.println("Dragon: " + num1 + "*" + num3 + "=" + answer);.println("Dragon: " + num1 + "*" + num3 + "=" + answer);.println("Dragon: " + num1 + "*" + num3 + "=" + answer);.println("Dragon: " + num1 + "*" + num3 + "=" + answer);.println("Dragon: " + num1 + "*" + num3 + "=" + answer);.println("Dragon: " + num1 + "*" + num3 + "=" + answer);.println("Dragon: " + num1 + "*" + num3 + "=" + answer);.println("Dragon: " + num1 + "*" + num3 + "=" + answer);.println("Dragon: " + num1 + "*" + num3 + "=" + answer);.println("Dragon: " + num1 + "*" + num3 + "=" + answer);.println("Dragon: " + num1 + "*" + num3 + "=" + answer);.println("Dragon: " + num1 + "*" + num3 + "=" + answer);.println("Dragon: " + num1 + "*" + num3 + "=" + answer);.println("Dragon: " + num1 + "*" + num3 + "=" + answer);.println("Dragon: " + num1 + "*" + num3 + "=" + answer);.println("Dragon: " + num1 + "*" + num3 + "=" + answer);.println("Dragon: " + num1 + "*" + num3 + "=" + answer);.println("Dragon: " + num1 + "*" + num3 + "=" + answer);.println("Dragon: " + num1 + "*" + num3 + "=" + answer); } } } }}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/multipleMultiplication.java

1.1 of 1 2014.12.03 14:56:37

Page 50: Text adventure

1234567891011121314151617

192021222324252627282930313233343536373839404142434445

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class multipleOrNot { {

public static void public static void public static void public static void public static void public static void public static void multipleOrNotKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in);); System. System. System.out.println("Assassin: 'Enter the smaller number first please.".println("Assassin: 'Enter the smaller number first please.".println("Assassin: 'Enter the smaller number first please.".println("Assassin: 'Enter the smaller number first please.".println("Assassin: 'Enter the smaller number first please.".println("Assassin: 'Enter the smaller number first please." + "'"); + "'"); + "'"); + "'"); + "'"); + "'"); + "'"); + "'"); int x = in.nextInt(); int x = in.nextInt(); int x = in.nextInt(); int x = in.nextInt(); int x = in.nextInt(); int x = in.nextInt(); int x = in.nextInt(); int x = in.nextInt(); int x = in.nextInt(); int x = in.nextInt(); int x = in.nextInt(); int x = in.nextInt(); int x = in.nextInt(); System. System. System.out.println("Assassin: 'Now the larger one'");.println("Assassin: 'Now the larger one'");.println("Assassin: 'Now the larger one'");.println("Assassin: 'Now the larger one'");.println("Assassin: 'Now the larger one'");.println("Assassin: 'Now the larger one'");.println("Assassin: 'Now the larger one'");.println("Assassin: 'Now the larger one'"); int y = in.nextInt(); int y = in.nextInt(); int y = in.nextInt(); int y = in.nextInt(); int y = in.nextInt(); int y = in.nextInt(); int y = in.nextInt(); int y = in.nextInt(); int y = in.nextInt(); int y = in.nextInt(); int y = in.nextInt(); int y = in.nextInt(); int y = in.nextInt();

System. System. System.out.println(.println(.println(multiples(x, y));(x, y));(x, y));(x, y));(x, y));(x, y));(x, y));(x, y));

} }

public static boolean public static boolean public static boolean public static boolean public static boolean public static boolean public static boolean multiples(int x, int y) {(int x, int y) {(int x, int y) {(int x, int y) {(int x, int y) {(int x, int y) {(int x, int y) {(int x, int y) {(int x, int y) {(int x, int y) {(int x, int y) {(int x, int y) { boolean multiple; boolean multiple; boolean multiple; boolean multiple; boolean multiple; if (y % x == 0) { if (y % x == 0) { if (y % x == 0) { if (y % x == 0) { if (y % x == 0) { if (y % x == 0) { if (y % x == 0) { if (y % x == 0) { if (y % x == 0) { if (y % x == 0) { if (y % x == 0) { if (y % x == 0) { if (y % x == 0) { if (y % x == 0) { if (y % x == 0) { if (y % x == 0) { multiple = true; multiple = true; multiple = true; multiple = true; multiple = true; multiple = true; multiple = true; System. System. System.out.println("Assassin: 'Hm so it seems they are related, ".println("Assassin: 'Hm so it seems they are related, ".println("Assassin: 'Hm so it seems they are related, ".println("Assassin: 'Hm so it seems they are related, ".println("Assassin: 'Hm so it seems they are related, ".println("Assassin: 'Hm so it seems they are related, " + "interesting'"); + "interesting'"); + "interesting'"); + "interesting'"); + "interesting'"); + "interesting'"); + "interesting'"); + "interesting'"); } else { } else { } else { } else { } else { } else { multiple = false; multiple = false; multiple = false; multiple = false; multiple = false; multiple = false; multiple = false; System. System. System.out.println("Assassin: 'hm, it seems I've made an error. ".println("Assassin: 'hm, it seems I've made an error. ".println("Assassin: 'hm, it seems I've made an error. ".println("Assassin: 'hm, it seems I've made an error. ".println("Assassin: 'hm, it seems I've made an error. ".println("Assassin: 'hm, it seems I've made an error. " + "Thank you friend'"); + "Thank you friend'"); + "Thank you friend'"); + "Thank you friend'"); + "Thank you friend'"); + "Thank you friend'"); + "Thank you friend'"); + "Thank you friend'"); } } return multiple; return multiple; return multiple; return multiple; return multiple; } }

}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/multipleOrNot.java

1.1 of 1 2014.12.03 14:54:14

Page 51: Text adventure

123456789101112131415161718192021222324252627282930

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class multiplicationSimple { {

public static void public static void public static void public static void public static void public static void public static void multiplicationSimpleKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in); ); ); System. System. System.out.println("'Enter the 1st number' the children ask excitedly");.println("'Enter the 1st number' the children ask excitedly");.println("'Enter the 1st number' the children ask excitedly");.println("'Enter the 1st number' the children ask excitedly");.println("'Enter the 1st number' the children ask excitedly");.println("'Enter the 1st number' the children ask excitedly");.println("'Enter the 1st number' the children ask excitedly");.println("'Enter the 1st number' the children ask excitedly"); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); System. System. System.out.println("'Enter the 2nd number' the children ask excitedly");.println("'Enter the 2nd number' the children ask excitedly");.println("'Enter the 2nd number' the children ask excitedly");.println("'Enter the 2nd number' the children ask excitedly");.println("'Enter the 2nd number' the children ask excitedly");.println("'Enter the 2nd number' the children ask excitedly");.println("'Enter the 2nd number' the children ask excitedly");.println("'Enter the 2nd number' the children ask excitedly"); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int product = num1 * num2; int product = num1 * num2; int product = num1 * num2; int product = num1 * num2; int product = num1 * num2; int product = num1 * num2; int product = num1 * num2; int product = num1 * num2; int product = num1 * num2; int product = num1 * num2; int product = num1 * num2; int product = num1 * num2; int product = num1 * num2; int product = num1 * num2; System. System. System.out.print("'The product of the two numbers is " + product);.print("'The product of the two numbers is " + product);.print("'The product of the two numbers is " + product);.print("'The product of the two numbers is " + product);.print("'The product of the two numbers is " + product);.print("'The product of the two numbers is " + product);.print("'The product of the two numbers is " + product);.print("'The product of the two numbers is " + product);.print("'The product of the two numbers is " + product);.print("'The product of the two numbers is " + product);.print("'The product of the two numbers is " + product);.print("'The product of the two numbers is " + product); System. System. System.out.println("' The children shout with excitment.");.println("' The children shout with excitment.");.println("' The children shout with excitment.");.println("' The children shout with excitment.");.println("' The children shout with excitment.");.println("' The children shout with excitment.");.println("' The children shout with excitment.");.println("' The children shout with excitment."); } }

}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/multiplicationSimple.java

1.1 of 1 2014.12.03 13:30:14

Page 52: Text adventure

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.*;import java.util.*;import java.util.*;import java.util.*;import java.util.*;import java.util.*;import java.util.*;import java.util.*;

class class multiplyMatricies { {

public static void public static void public static void public static void public static void public static void public static void multiplyMatriciesKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in);); int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; int scan = 0, row1 = 0, collum1 = 0, row2 = 0, collum2 = 0; double num1, num2, num3, num4; double num1, num2, num3, num4; double num1, num2, num3, num4; double num1, num2, num3, num4; double num1, num2, num3, num4; double num1, num2, num3, num4; double num1, num2, num3, num4; double num1, num2, num3, num4; double num1, num2, num3, num4; double num1, num2, num3, num4; double num1, num2, num3, num4; double num1, num2, num3, num4; double num1, num2, num3, num4; double num1, num2, num3, num4; // Makes sure the two matricies can be multiplied together // Makes sure the two matricies can be multiplied together while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { System. System. System.out.println("Baldroy: 'The first matrix is...'");.println("Baldroy: 'The first matrix is...'");.println("Baldroy: 'The first matrix is...'");.println("Baldroy: 'The first matrix is...'");.println("Baldroy: 'The first matrix is...'");.println("Baldroy: 'The first matrix is...'");.println("Baldroy: 'The first matrix is...'");.println("Baldroy: 'The first matrix is...'"); row1 = in.nextInt(); row1 = in.nextInt(); row1 = in.nextInt(); row1 = in.nextInt(); row1 = in.nextInt(); row1 = in.nextInt(); row1 = in.nextInt(); row1 = in.nextInt(); row1 = in.nextInt(); row1 = in.nextInt(); row1 = in.nextInt(); System. System. System.out.println("Baldroy: 'by...'");.println("Baldroy: 'by...'");.println("Baldroy: 'by...'");.println("Baldroy: 'by...'");.println("Baldroy: 'by...'");.println("Baldroy: 'by...'");.println("Baldroy: 'by...'");.println("Baldroy: 'by...'"); collum1 = in.nextInt(); collum1 = in.nextInt(); collum1 = in.nextInt(); collum1 = in.nextInt(); collum1 = in.nextInt(); collum1 = in.nextInt(); collum1 = in.nextInt(); collum1 = in.nextInt(); collum1 = in.nextInt(); collum1 = in.nextInt(); collum1 = in.nextInt(); System. System. System.out.println("Baldroy: 'The second matric is...'");.println("Baldroy: 'The second matric is...'");.println("Baldroy: 'The second matric is...'");.println("Baldroy: 'The second matric is...'");.println("Baldroy: 'The second matric is...'");.println("Baldroy: 'The second matric is...'");.println("Baldroy: 'The second matric is...'");.println("Baldroy: 'The second matric is...'"); row2 = in.nextInt(); row2 = in.nextInt(); row2 = in.nextInt(); row2 = in.nextInt(); row2 = in.nextInt(); row2 = in.nextInt(); row2 = in.nextInt(); row2 = in.nextInt(); row2 = in.nextInt(); row2 = in.nextInt(); row2 = in.nextInt(); System. System. System.out.println("Baldroy: 'by...'");.println("Baldroy: 'by...'");.println("Baldroy: 'by...'");.println("Baldroy: 'by...'");.println("Baldroy: 'by...'");.println("Baldroy: 'by...'");.println("Baldroy: 'by...'");.println("Baldroy: 'by...'"); collum2 = in.nextInt(); collum2 = in.nextInt(); collum2 = in.nextInt(); collum2 = in.nextInt(); collum2 = in.nextInt(); collum2 = in.nextInt(); collum2 = in.nextInt(); collum2 = in.nextInt(); collum2 = in.nextInt(); collum2 = in.nextInt(); collum2 = in.nextInt(); if (collum1 == row2) { if (collum1 == row2) { if (collum1 == row2) { if (collum1 == row2) { if (collum1 == row2) { if (collum1 == row2) { if (collum1 == row2) { if (collum1 == row2) { if (collum1 == row2) { if (collum1 == row2) { if (collum1 == row2) { if (collum1 == row2) { scan++; scan++; scan++; scan++; } else { } else { } else { } else { } else { } else { System. System. System.out.println("The number of collums in matrix one must be".println("The number of collums in matrix one must be".println("The number of collums in matrix one must be".println("The number of collums in matrix one must be".println("The number of collums in matrix one must be".println("The number of collums in matrix one must be" + " equal to the number of rows in matrix 2"); + " equal to the number of rows in matrix 2"); + " equal to the number of rows in matrix 2"); + " equal to the number of rows in matrix 2"); + " equal to the number of rows in matrix 2"); + " equal to the number of rows in matrix 2"); + " equal to the number of rows in matrix 2"); + " equal to the number of rows in matrix 2"); } } } } double array[][] = new double[row1][collum1]; double array[][] = new double[row1][collum1]; double array[][] = new double[row1][collum1]; double array[][] = new double[row1][collum1]; double array[][] = new double[row1][collum1]; double array[][] = new double[row1][collum1]; double array[][] = new double[row1][collum1]; double array[][] = new double[row1][collum1]; double array[][] = new double[row1][collum1]; double array[][] = new double[row1][collum1]; double array[][] = new double[row1][collum1]; double array[][] = new double[row1][collum1]; double array[][] = new double[row1][collum1]; double array[][] = new double[row1][collum1]; double array[][] = new double[row1][collum1]; double array[][] = new double[row1][collum1]; double array[][] = new double[row1][collum1]; double array[][] = new double[row1][collum1]; double array[][] = new double[row1][collum1]; double array[][] = new double[row1][collum1]; double array[][] = new double[row1][collum1]; double array1[][] = new double[row2][collum2]; double array1[][] = new double[row2][collum2]; double array1[][] = new double[row2][collum2]; double array1[][] = new double[row2][collum2]; double array1[][] = new double[row2][collum2]; double array1[][] = new double[row2][collum2]; double array1[][] = new double[row2][collum2]; double array1[][] = new double[row2][collum2]; double array1[][] = new double[row2][collum2]; double array1[][] = new double[row2][collum2]; double array1[][] = new double[row2][collum2]; double array1[][] = new double[row2][collum2]; double array1[][] = new double[row2][collum2]; double array1[][] = new double[row2][collum2]; double array1[][] = new double[row2][collum2]; double array1[][] = new double[row2][collum2]; double array1[][] = new double[row2][collum2]; double array1[][] = new double[row2][collum2]; double array1[][] = new double[row2][collum2]; double array1[][] = new double[row2][collum2]; double array1[][] = new double[row2][collum2]; double array2[][] = new double[row1][collum2]; double array2[][] = new double[row1][collum2]; double array2[][] = new double[row1][collum2]; double array2[][] = new double[row1][collum2]; double array2[][] = new double[row1][collum2]; double array2[][] = new double[row1][collum2]; double array2[][] = new double[row1][collum2]; double array2[][] = new double[row1][collum2]; double array2[][] = new double[row1][collum2]; double array2[][] = new double[row1][collum2]; double array2[][] = new double[row1][collum2]; double array2[][] = new double[row1][collum2]; double array2[][] = new double[row1][collum2]; double array2[][] = new double[row1][collum2]; double array2[][] = new double[row1][collum2]; double array2[][] = new double[row1][collum2]; double array2[][] = new double[row1][collum2]; double array2[][] = new double[row1][collum2]; double array2[][] = new double[row1][collum2]; double array2[][] = new double[row1][collum2]; double array2[][] = new double[row1][collum2];

// fills matrix one // fills matrix one for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int collum = 0; collum < collum1; collum++) { for (int collum = 0; collum < collum1; collum++) { for (int collum = 0; collum < collum1; collum++) { for (int collum = 0; collum < collum1; collum++) { for (int collum = 0; collum < collum1; collum++) { for (int collum = 0; collum < collum1; collum++) { for (int collum = 0; collum < collum1; collum++) { for (int collum = 0; collum < collum1; collum++) { for (int collum = 0; collum < collum1; collum++) { for (int collum = 0; collum < collum1; collum++) { for (int collum = 0; collum < collum1; collum++) { for (int collum = 0; collum < collum1; collum++) { for (int collum = 0; collum < collum1; collum++) { for (int collum = 0; collum < collum1; collum++) { for (int collum = 0; collum < collum1; collum++) { for (int collum = 0; collum < collum1; collum++) { for (int collum = 0; collum < collum1; collum++) { for (int collum = 0; collum < collum1; collum++) { for (int collum = 0; collum < collum1; collum++) { for (int collum = 0; collum < collum1; collum++) { for (int collum = 0; collum < collum1; collum++) { for (int collum = 0; collum < collum1; collum++) { for (int collum = 0; collum < collum1; collum++) { for (int collum = 0; collum < collum1; collum++) { for (int collum = 0; collum < collum1; collum++) { num1 = row + 1; num1 = row + 1; num1 = row + 1; num1 = row + 1; num1 = row + 1; num1 = row + 1; num1 = row + 1; num1 = row + 1; num1 = row + 1; num1 = row + 1; num1 = row + 1; num2 = collum + 1; num2 = collum + 1; num2 = collum + 1; num2 = collum + 1; num2 = collum + 1; num2 = collum + 1; num2 = collum + 1; num2 = collum + 1; num2 = collum + 1; num2 = collum + 1; num2 = collum + 1; System. System. System.out.println("1st matrix, value in [" + (int) num1 + "][".println("1st matrix, value in [" + (int) num1 + "][".println("1st matrix, value in [" + (int) num1 + "][".println("1st matrix, value in [" + (int) num1 + "][".println("1st matrix, value in [" + (int) num1 + "][".println("1st matrix, value in [" + (int) num1 + "][".println("1st matrix, value in [" + (int) num1 + "][".println("1st matrix, value in [" + (int) num1 + "][".println("1st matrix, value in [" + (int) num1 + "][".println("1st matrix, value in [" + (int) num1 + "][".println("1st matrix, value in [" + (int) num1 + "][".println("1st matrix, value in [" + (int) num1 + "][".println("1st matrix, value in [" + (int) num1 + "][".println("1st matrix, value in [" + (int) num1 + "][".println("1st matrix, value in [" + (int) num1 + "][".println("1st matrix, value in [" + (int) num1 + "][".println("1st matrix, value in [" + (int) num1 + "][".println("1st matrix, value in [" + (int) num1 + "][".println("1st matrix, value in [" + (int) num1 + "][".println("1st matrix, value in [" + (int) num1 + "][" + (int) num2 + "]:"); + (int) num2 + "]:"); + (int) num2 + "]:"); + (int) num2 + "]:"); + (int) num2 + "]:"); + (int) num2 + "]:"); + (int) num2 + "]:"); + (int) num2 + "]:"); + (int) num2 + "]:"); + (int) num2 + "]:"); + (int) num2 + "]:"); + (int) num2 + "]:"); + (int) num2 + "]:"); + (int) num2 + "]:"); + (int) num2 + "]:"); + (int) num2 + "]:"); array[row][collum] = in.nextDouble(); array[row][collum] = in.nextDouble(); array[row][collum] = in.nextDouble(); array[row][collum] = in.nextDouble(); array[row][collum] = in.nextDouble(); array[row][collum] = in.nextDouble(); array[row][collum] = in.nextDouble(); array[row][collum] = in.nextDouble(); array[row][collum] = in.nextDouble(); array[row][collum] = in.nextDouble(); array[row][collum] = in.nextDouble(); array[row][collum] = in.nextDouble(); array[row][collum] = in.nextDouble(); array[row][collum] = in.nextDouble(); array[row][collum] = in.nextDouble(); array[row][collum] = in.nextDouble(); array[row][collum] = in.nextDouble(); } } } }

// fills matrix 2 // fills matrix 2 for (int row = 0; row < row2; row++) { for (int row = 0; row < row2; row++) { for (int row = 0; row < row2; row++) { for (int row = 0; row < row2; row++) { for (int row = 0; row < row2; row++) { for (int row = 0; row < row2; row++) { for (int row = 0; row < row2; row++) { for (int row = 0; row < row2; row++) { for (int row = 0; row < row2; row++) { for (int row = 0; row < row2; row++) { for (int row = 0; row < row2; row++) { for (int row = 0; row < row2; row++) { for (int row = 0; row < row2; row++) { for (int row = 0; row < row2; row++) { for (int row = 0; row < row2; row++) { for (int row = 0; row < row2; row++) { for (int row = 0; row < row2; row++) { for (int row = 0; row < row2; row++) { for (int row = 0; row < row2; row++) { for (int row = 0; row < row2; row++) { for (int row = 0; row < row2; row++) { for (int row = 0; row < row2; row++) { for (int row = 0; row < row2; row++) { for (int row = 0; row < row2; row++) { for (int row = 0; row < row2; row++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { num1 = row + 1; num1 = row + 1; num1 = row + 1; num1 = row + 1; num1 = row + 1; num1 = row + 1; num1 = row + 1; num1 = row + 1; num1 = row + 1; num1 = row + 1; num1 = row + 1; num2 = collum + 1; num2 = collum + 1; num2 = collum + 1; num2 = collum + 1; num2 = collum + 1; num2 = collum + 1; num2 = collum + 1; num2 = collum + 1; num2 = collum + 1; num2 = collum + 1; num2 = collum + 1; System. System. System.out.println("2nd matrix, value in [" + (int) num1 + "][".println("2nd matrix, value in [" + (int) num1 + "][".println("2nd matrix, value in [" + (int) num1 + "][".println("2nd matrix, value in [" + (int) num1 + "][".println("2nd matrix, value in [" + (int) num1 + "][".println("2nd matrix, value in [" + (int) num1 + "][".println("2nd matrix, value in [" + (int) num1 + "][".println("2nd matrix, value in [" + (int) num1 + "][".println("2nd matrix, value in [" + (int) num1 + "][".println("2nd matrix, value in [" + (int) num1 + "][".println("2nd matrix, value in [" + (int) num1 + "][".println("2nd matrix, value in [" + (int) num1 + "][".println("2nd matrix, value in [" + (int) num1 + "][".println("2nd matrix, value in [" + (int) num1 + "][".println("2nd matrix, value in [" + (int) num1 + "][".println("2nd matrix, value in [" + (int) num1 + "][".println("2nd matrix, value in [" + (int) num1 + "][".println("2nd matrix, value in [" + (int) num1 + "][".println("2nd matrix, value in [" + (int) num1 + "][".println("2nd matrix, value in [" + (int) num1 + "][" + (int) num2 + "]:"); + (int) num2 + "]:"); + (int) num2 + "]:"); + (int) num2 + "]:"); + (int) num2 + "]:"); + (int) num2 + "]:"); + (int) num2 + "]:"); + (int) num2 + "]:"); + (int) num2 + "]:"); + (int) num2 + "]:"); + (int) num2 + "]:"); + (int) num2 + "]:"); + (int) num2 + "]:"); + (int) num2 + "]:"); + (int) num2 + "]:"); + (int) num2 + "]:"); array1[row][collum] = in.nextDouble(); array1[row][collum] = in.nextDouble(); array1[row][collum] = in.nextDouble(); array1[row][collum] = in.nextDouble(); array1[row][collum] = in.nextDouble(); array1[row][collum] = in.nextDouble(); array1[row][collum] = in.nextDouble(); array1[row][collum] = in.nextDouble(); array1[row][collum] = in.nextDouble(); array1[row][collum] = in.nextDouble(); array1[row][collum] = in.nextDouble(); array1[row][collum] = in.nextDouble(); array1[row][collum] = in.nextDouble(); array1[row][collum] = in.nextDouble(); array1[row][collum] = in.nextDouble(); array1[row][collum] = in.nextDouble(); array1[row][collum] = in.nextDouble(); } } } }

// this does the heavy lifting, multiplies the two matricies together. // this does the heavy lifting, multiplies the two matricies together. for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { num3 = 0; num3 = 0; num3 = 0; num3 = 0; num3 = 0; num3 = 0; num3 = 0; for (int count = 0; count < collum1; count++) { for (int count = 0; count < collum1; count++) { for (int count = 0; count < collum1; count++) { for (int count = 0; count < collum1; count++) { for (int count = 0; count < collum1; count++) { for (int count = 0; count < collum1; count++) { for (int count = 0; count < collum1; count++) { for (int count = 0; count < collum1; count++) { for (int count = 0; count < collum1; count++) { for (int count = 0; count < collum1; count++) { for (int count = 0; count < collum1; count++) { for (int count = 0; count < collum1; count++) { for (int count = 0; count < collum1; count++) { for (int count = 0; count < collum1; count++) { for (int count = 0; count < collum1; count++) { for (int count = 0; count < collum1; count++) { for (int count = 0; count < collum1; count++) { for (int count = 0; count < collum1; count++) { for (int count = 0; count < collum1; count++) { for (int count = 0; count < collum1; count++) { for (int count = 0; count < collum1; count++) { for (int count = 0; count < collum1; count++) { for (int count = 0; count < collum1; count++) { for (int count = 0; count < collum1; count++) { for (int count = 0; count < collum1; count++) { num4 = (array[row][count] * array1[count][collum]); num4 = (array[row][count] * array1[count][collum]); num4 = (array[row][count] * array1[count][collum]); num4 = (array[row][count] * array1[count][collum]); num4 = (array[row][count] * array1[count][collum]); num4 = (array[row][count] * array1[count][collum]); num4 = (array[row][count] * array1[count][collum]); num4 = (array[row][count] * array1[count][collum]); num4 = (array[row][count] * array1[count][collum]); num4 = (array[row][count] * array1[count][collum]); num4 = (array[row][count] * array1[count][collum]); num4 = (array[row][count] * array1[count][collum]); num4 = (array[row][count] * array1[count][collum]); num4 = (array[row][count] * array1[count][collum]); num4 = (array[row][count] * array1[count][collum]); num4 = (array[row][count] * array1[count][collum]); num4 = (array[row][count] * array1[count][collum]); num4 = (array[row][count] * array1[count][collum]); num4 = (array[row][count] * array1[count][collum]); num4 = (array[row][count] * array1[count][collum]); num4 = (array[row][count] * array1[count][collum]); num4 = (array[row][count] * array1[count][collum]); num4 = (array[row][count] * array1[count][collum]); num4 = (array[row][count] * array1[count][collum]); num4 = (array[row][count] * array1[count][collum]); num3 = num3 + num4; num3 = num3 + num4; num3 = num3 + num4; num3 = num3 + num4; num3 = num3 + num4; num3 = num3 + num4; num3 = num3 + num4; num3 = num3 + num4; num3 = num3 + num4; num3 = num3 + num4; num3 = num3 + num4; } } array2[row][collum] = num3; array2[row][collum] = num3; array2[row][collum] = num3; array2[row][collum] = num3; array2[row][collum] = num3; array2[row][collum] = num3; array2[row][collum] = num3; array2[row][collum] = num3; array2[row][collum] = num3; array2[row][collum] = num3; array2[row][collum] = num3; array2[row][collum] = num3; array2[row][collum] = num3;

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/multiplyMatricies.java

1.1 of 2 2014.12.03 13:58:03

Page 53: Text adventure

737475767778798081828384858687888990

array2[row][collum] = num3; array2[row][collum] = num3; array2[row][collum] = num3; array2[row][collum] = num3; array2[row][collum] = num3; array2[row][collum] = num3; array2[row][collum] = num3; array2[row][collum] = num3; array2[row][collum] = num3; array2[row][collum] = num3; array2[row][collum] = num3; array2[row][collum] = num3; array2[row][collum] = num3; } } } } System. System. System.out.println("Baldroy: 'Product of both matricies is :");.println("Baldroy: 'Product of both matricies is :");.println("Baldroy: 'Product of both matricies is :");.println("Baldroy: 'Product of both matricies is :");.println("Baldroy: 'Product of both matricies is :");.println("Baldroy: 'Product of both matricies is :");.println("Baldroy: 'Product of both matricies is :");.println("Baldroy: 'Product of both matricies is :");

// prints the product of the two matricies // prints the product of the two matricies for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int row = 0; row < row1; row++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { for (int collum = 0; collum < collum2; collum++) { System. System. System.out.print(array2[row][collum] + ".print(array2[row][collum] + ".print(array2[row][collum] + ".print(array2[row][collum] + ".print(array2[row][collum] + ".print(array2[row][collum] + ".print(array2[row][collum] + ".print(array2[row][collum] + ".print(array2[row][collum] + ".print(array2[row][collum] + ".print(array2[row][collum] + ".print(array2[row][collum] + ".print(array2[row][collum] + ".print(array2[row][collum] + "\t");");"); } } System. System. System.out.println();.println();.println();.println();.println(); } } System. System. System.out.println("'");.println("'");.println("'");.println("'");.println("'");.println("'");.println("'");.println("'"); System. System. System.out.println("Baldroy: 'Yea, I think that's right! Awesome! Thank".println("Baldroy: 'Yea, I think that's right! Awesome! Thank".println("Baldroy: 'Yea, I think that's right! Awesome! Thank".println("Baldroy: 'Yea, I think that's right! Awesome! Thank".println("Baldroy: 'Yea, I think that's right! Awesome! Thank".println("Baldroy: 'Yea, I think that's right! Awesome! Thank" + "s little guy!"); + "s little guy!"); + "s little guy!"); + "s little guy!"); + "s little guy!"); + "s little guy!"); + "s little guy!"); + "s little guy!"); } }}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/multiplyMatricies.java

2.1 of 2 2014.12.03 13:58:03

Page 54: Text adventure

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

class class nameBookMail { {

public static void public static void public static void public static void public static void public static void public static void nameBookMailKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in); // in because patterns); // in because patterns); // in because patterns); // in because patterns author aut; author aut; author aut; author aut; author aut;

System. System. System.out.println("Vader: 'what's your name?'");.println("Vader: 'what's your name?'");.println("Vader: 'what's your name?'");.println("Vader: 'what's your name?'");.println("Vader: 'what's your name?'");.println("Vader: 'what's your name?'");.println("Vader: 'what's your name?'");.println("Vader: 'what's your name?'"); String someName = in.nextLine(); String someName = in.nextLine(); String someName = in.nextLine(); String someName = in.nextLine(); String someName = in.nextLine(); String someName = in.nextLine(); String someName = in.nextLine(); String someName = in.nextLine(); String someName = in.nextLine(); String someName = in.nextLine(); String someName = in.nextLine(); String someName = in.nextLine(); String someName = in.nextLine();

System. System. System.out.println("Vader: 'what's your email?");.println("Vader: 'what's your email?");.println("Vader: 'what's your email?");.println("Vader: 'what's your email?");.println("Vader: 'what's your email?");.println("Vader: 'what's your email?");.println("Vader: 'what's your email?");.println("Vader: 'what's your email?"); String sEmail = in.nextLine(); String sEmail = in.nextLine(); String sEmail = in.nextLine(); String sEmail = in.nextLine(); String sEmail = in.nextLine(); String sEmail = in.nextLine(); String sEmail = in.nextLine(); String sEmail = in.nextLine(); String sEmail = in.nextLine(); String sEmail = in.nextLine(); String sEmail = in.nextLine(); String sEmail = in.nextLine(); String sEmail = in.nextLine();

System. System. System.out.println("Vader: 'Which of my books is this?'");.println("Vader: 'Which of my books is this?'");.println("Vader: 'Which of my books is this?'");.println("Vader: 'Which of my books is this?'");.println("Vader: 'Which of my books is this?'");.println("Vader: 'Which of my books is this?'");.println("Vader: 'Which of my books is this?'");.println("Vader: 'Which of my books is this?'"); String sBook = in.nextLine(); String sBook = in.nextLine(); String sBook = in.nextLine(); String sBook = in.nextLine(); String sBook = in.nextLine(); String sBook = in.nextLine(); String sBook = in.nextLine(); String sBook = in.nextLine(); String sBook = in.nextLine(); String sBook = in.nextLine(); String sBook = in.nextLine(); String sBook = in.nextLine(); String sBook = in.nextLine();

aut = new author(); aut = new author(); aut = new author(); aut = new author(); aut = new author(); aut = new author(); aut = new author(); aut = new author(); aut = new author(); aut = new author(); aut = new author(); aut.name(someName); // gets name aut.name(someName); // gets name aut.name(someName); // gets name aut.name(someName); // gets name aut.name(someName); // gets name aut.name(someName); // gets name aut.name(someName); // gets name aut.name(someName); // gets name aut.name(someName); // gets name aut.name(someName); // gets name aut.email(sEmail); // gets mail aut.email(sEmail); // gets mail aut.email(sEmail); // gets mail aut.email(sEmail); // gets mail aut.email(sEmail); // gets mail aut.email(sEmail); // gets mail aut.email(sEmail); // gets mail aut.email(sEmail); // gets mail aut.email(sEmail); // gets mail aut.email(sEmail); // gets mail aut.book(sBook); // gets book title aut.book(sBook); // gets book title aut.book(sBook); // gets book title aut.book(sBook); // gets book title aut.book(sBook); // gets book title aut.book(sBook); // gets book title aut.book(sBook); // gets book title aut.book(sBook); // gets book title aut.book(sBook); // gets book title aut.book(sBook); // gets book title System. System. System.out.println("The inscription reads:");.println("The inscription reads:");.println("The inscription reads:");.println("The inscription reads:");.println("The inscription reads:");.println("The inscription reads:");.println("The inscription reads:");.println("The inscription reads:"); System. System. System.out.println(aut.name(someName) + ".println(aut.name(someName) + ".println(aut.name(someName) + ".println(aut.name(someName) + ".println(aut.name(someName) + ".println(aut.name(someName) + ".println(aut.name(someName) + ".println(aut.name(someName) + ".println(aut.name(someName) + ".println(aut.name(someName) + ".println(aut.name(someName) + ".println(aut.name(someName) + ".println(aut.name(someName) + "\n" + aut.email(sEmail)" + aut.email(sEmail)" + aut.email(sEmail)" + aut.email(sEmail)" + aut.email(sEmail)" + aut.email(sEmail)" + aut.email(sEmail)" + aut.email(sEmail)" + aut.email(sEmail)" + aut.email(sEmail) + " + " + " + "\n" + aut.book(sBook));" + aut.book(sBook));" + aut.book(sBook));" + aut.book(sBook));" + aut.book(sBook));" + aut.book(sBook));" + aut.book(sBook));" + aut.book(sBook));" + aut.book(sBook));" + aut.book(sBook));" + aut.book(sBook));" + aut.book(sBook));

} }

}

class class author { {

private String name, email, book; private String name, email, book; private String name, email, book; private String name, email, book; private String name, email, book; private String name, email, book; private String name, email, book; private String name, email, book; private String name, email, book; private String name, email, book; private String name, email, book; private String name, email, book; private String name, email, book;

public String public String public String public String public String name(String name) {(String name) {(String name) {(String name) {(String name) {(String name) {(String name) { this.name = name; this.name = name; this.name = name; this.name = name; this.name = name; this.name = name; this.name = name; this.name = name; this.name = name; return name; return name; return name; return name; return name; } }

public String public String public String public String public String email(String email) {(String email) {(String email) {(String email) {(String email) {(String email) {(String email) { this.email = email; this.email = email; this.email = email; this.email = email; this.email = email; this.email = email; this.email = email; this.email = email; this.email = email; return email; return email; return email; return email; return email; } }

public String public String public String public String public String book(String book) {(String book) {(String book) {(String book) {(String book) {(String book) {(String book) { this.book = book; this.book = book; this.book = book; this.book = book; this.book = book; this.book = book; this.book = book; this.book = book; this.book = book; return book; return book; return book; return book; return book; } }}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/nameBookMail.java

1.1 of 2 2014.12.03 14:37:45

Page 55: Text adventure

63

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/nameBookMail.java

2.1 of 2 2014.12.03 14:37:45

Page 56: Text adventure

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class numberOfAs { {

public static void public static void public static void public static void public static void public static void public static void numberOfAsKing() {() {() {() {

Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in); ); );

System. System. System.out.println("clown: 'Oh please do give me a sentance' ");.println("clown: 'Oh please do give me a sentance' ");.println("clown: 'Oh please do give me a sentance' ");.println("clown: 'Oh please do give me a sentance' ");.println("clown: 'Oh please do give me a sentance' ");.println("clown: 'Oh please do give me a sentance' ");.println("clown: 'Oh please do give me a sentance' ");.println("clown: 'Oh please do give me a sentance' "); String str = in.nextLine(); String str = in.nextLine(); String str = in.nextLine(); String str = in.nextLine(); String str = in.nextLine(); String str = in.nextLine(); String str = in.nextLine(); String str = in.nextLine(); String str = in.nextLine(); String str = in.nextLine(); String str = in.nextLine(); String str = in.nextLine(); String str = in.nextLine(); int count = 0; //number of a's int count = 0; //number of a's int count = 0; //number of a's int count = 0; //number of a's int count = 0; //number of a's int count = 0; //number of a's int count = 0; //number of a's int count = 0; //number of a's int count = 0; //number of a's int count = 0; //number of a's int count = 0; //number of a's int letterInString = 0; //letter in the string int letterInString = 0; //letter in the string int letterInString = 0; //letter in the string int letterInString = 0; //letter in the string int letterInString = 0; //letter in the string int letterInString = 0; //letter in the string int letterInString = 0; //letter in the string int letterInString = 0; //letter in the string int letterInString = 0; //letter in the string int letterInString = 0; //letter in the string int letterInString = 0; //letter in the string while (letterInString < str.length()) { while (letterInString < str.length()) { while (letterInString < str.length()) { while (letterInString < str.length()) { while (letterInString < str.length()) { while (letterInString < str.length()) { while (letterInString < str.length()) { while (letterInString < str.length()) { while (letterInString < str.length()) { while (letterInString < str.length()) { while (letterInString < str.length()) { while (letterInString < str.length()) { while (letterInString < str.length()) { while (letterInString < str.length()) { while (letterInString < str.length()) { while (letterInString < str.length()) { if (str.charAt(letterInString) == 'a') { if (str.charAt(letterInString) == 'a') { if (str.charAt(letterInString) == 'a') { if (str.charAt(letterInString) == 'a') { if (str.charAt(letterInString) == 'a') { if (str.charAt(letterInString) == 'a') { if (str.charAt(letterInString) == 'a') { if (str.charAt(letterInString) == 'a') { if (str.charAt(letterInString) == 'a') { if (str.charAt(letterInString) == 'a') { if (str.charAt(letterInString) == 'a') { if (str.charAt(letterInString) == 'a') { if (str.charAt(letterInString) == 'a') { if (str.charAt(letterInString) == 'a') { if (str.charAt(letterInString) == 'a') { if (str.charAt(letterInString) == 'a') { if (str.charAt(letterInString) == 'a') { if (str.charAt(letterInString) == 'a') { if (str.charAt(letterInString) == 'a') { count++; // counts number of A's count++; // counts number of A's count++; // counts number of A's count++; // counts number of A's count++; // counts number of A's count++; // counts number of A's } } letterInString++; // kills loop letterInString++; // kills loop letterInString++; // kills loop letterInString++; // kills loop letterInString++; // kills loop letterInString++; // kills loop } } if (count == 0) { // if no A's are in sentance, death scenario if (count == 0) { // if no A's are in sentance, death scenario if (count == 0) { // if no A's are in sentance, death scenario if (count == 0) { // if no A's are in sentance, death scenario if (count == 0) { // if no A's are in sentance, death scenario if (count == 0) { // if no A's are in sentance, death scenario if (count == 0) { // if no A's are in sentance, death scenario if (count == 0) { // if no A's are in sentance, death scenario if (count == 0) { // if no A's are in sentance, death scenario if (count == 0) { // if no A's are in sentance, death scenario if (count == 0) { // if no A's are in sentance, death scenario if (count == 0) { // if no A's are in sentance, death scenario if (count == 0) { // if no A's are in sentance, death scenario if (count == 0) { // if no A's are in sentance, death scenario System. System. System.out.println("Clown: 'There are no A's in this sentance. ".println("Clown: 'There are no A's in this sentance. ".println("Clown: 'There are no A's in this sentance. ".println("Clown: 'There are no A's in this sentance. ".println("Clown: 'There are no A's in this sentance. ".println("Clown: 'There are no A's in this sentance. " + "I told you I like A's!"); + "I told you I like A's!"); + "I told you I like A's!"); + "I told you I like A's!"); + "I told you I like A's!"); + "I told you I like A's!"); + "I told you I like A's!"); + "I told you I like A's!"); System. System. System.out.println("The clown takes out a knife as two other ".println("The clown takes out a knife as two other ".println("The clown takes out a knife as two other ".println("The clown takes out a knife as two other ".println("The clown takes out a knife as two other ".println("The clown takes out a knife as two other " + "clowns grab you from behind and hold you still"); + "clowns grab you from behind and hold you still"); + "clowns grab you from behind and hold you still"); + "clowns grab you from behind and hold you still"); + "clowns grab you from behind and hold you still"); + "clowns grab you from behind and hold you still"); + "clowns grab you from behind and hold you still"); + "clowns grab you from behind and hold you still"); System. System. System.out.println("Clown: 'I'll make an A!'");.println("Clown: 'I'll make an A!'");.println("Clown: 'I'll make an A!'");.println("Clown: 'I'll make an A!'");.println("Clown: 'I'll make an A!'");.println("Clown: 'I'll make an A!'");.println("Clown: 'I'll make an A!'");.println("Clown: 'I'll make an A!'"); System. System. System.out.println("The clown takes his knife and carves an A so ".println("The clown takes his knife and carves an A so ".println("The clown takes his knife and carves an A so ".println("The clown takes his knife and carves an A so ".println("The clown takes his knife and carves an A so ".println("The clown takes his knife and carves an A so " + "deep in your chest that you bleed to death"); + "deep in your chest that you bleed to death"); + "deep in your chest that you bleed to death"); + "deep in your chest that you bleed to death"); + "deep in your chest that you bleed to death"); + "deep in your chest that you bleed to death"); + "deep in your chest that you bleed to death"); + "deep in your chest that you bleed to death"); System. System. System.out.println("In your last moments you hear this:");.println("In your last moments you hear this:");.println("In your last moments you hear this:");.println("In your last moments you hear this:");.println("In your last moments you hear this:");.println("In your last moments you hear this:");.println("In your last moments you hear this:");.println("In your last moments you hear this:"); System. System. System.out.println("Clown: 'this man gave me a senace with no A's".println("Clown: 'this man gave me a senace with no A's".println("Clown: 'this man gave me a senace with no A's".println("Clown: 'this man gave me a senace with no A's".println("Clown: 'this man gave me a senace with no A's".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 " + " in it, for this I hang him here for all time, as a " + " in it, for this I hang him here for all time, as a " + " in it, for this I hang him here for all time, as a " + " in it, for this I hang him here for all time, as a " + " in it, for this I hang him here for all time, as a " + "warning.'"); + "warning.'"); + "warning.'"); + "warning.'"); + "warning.'"); + "warning.'"); + "warning.'"); + "warning.'"); System. System. System.out.println("You died, try again.");.println("You died, try again.");.println("You died, try again.");.println("You died, try again.");.println("You died, try again.");.println("You died, try again.");.println("You died, try again.");.println("You died, try again."); } else { // if 1 or more a's in sentance } else { // if 1 or more a's in sentance } else { // if 1 or more a's in sentance } else { // if 1 or more a's in sentance } else { // if 1 or more a's in sentance } else { // if 1 or more a's in sentance } else { // if 1 or more a's in sentance } else { // if 1 or more a's in sentance System. System. System.out.print("Clown: 'Oh goodie there are " + count);.print("Clown: 'Oh goodie there are " + count);.print("Clown: 'Oh goodie there are " + count);.print("Clown: 'Oh goodie there are " + count);.print("Clown: 'Oh goodie there are " + count);.print("Clown: 'Oh goodie there are " + count);.print("Clown: 'Oh goodie there are " + count);.print("Clown: 'Oh goodie there are " + count);.print("Clown: 'Oh goodie there are " + count);.print("Clown: 'Oh goodie there are " + count);.print("Clown: 'Oh goodie there are " + count);.print("Clown: 'Oh goodie there are " + count); System. System. System.out.println(" A's in this sentance, thank you for that, ".println(" A's in this sentance, thank you for that, ".println(" A's in this sentance, thank you for that, ".println(" A's in this sentance, thank you for that, ".println(" A's in this sentance, thank you for that, ".println(" A's in this sentance, thank you for that, " + "you may go.'"); + "you may go.'"); + "you may go.'"); + "you may go.'"); + "you may go.'"); + "you may go.'"); + "you may go.'"); + "you may go.'"); System. System. System.out.println("You leave wondering what would have happened ".println("You leave wondering what would have happened ".println("You leave wondering what would have happened ".println("You leave wondering what would have happened ".println("You leave wondering what would have happened ".println("You leave wondering what would have happened " + "if you had given him a sentance without any A's"); + "if you had given him a sentance without any A's"); + "if you had given him a sentance without any A's"); + "if you had given him a sentance without any A's"); + "if you had given him a sentance without any A's"); + "if you had given him a sentance without any A's"); + "if you had given him a sentance without any A's"); + "if you had given him a sentance without any A's"); } }

} }}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/numberOfAs.java

1.1 of 1 2014.12.03 15:05:12

Page 57: Text adventure

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class operations { {

public static void public static void public static void public static void public static void public static void public static void operationsKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in);); int center = 0, scan; int center = 0, scan; int center = 0, scan; int center = 0, scan; int center = 0, scan; int center = 0, scan; int center = 0, scan; int center = 0, scan; int center = 0, scan; int center = 0, scan; int center = 0, scan; int center = 0, scan;

System. System. System.out.println("You walk up to the town hall and a gaurd stops you".println("You walk up to the town hall and a gaurd stops you".println("You walk up to the town hall and a gaurd stops you".println("You walk up to the town hall and a gaurd stops you".println("You walk up to the town hall and a gaurd stops you".println("You walk up to the town hall and a gaurd stops you" ); ); ); System. System. System.out.println("Gaurd: 'Hault! Who goes there");.println("Gaurd: 'Hault! Who goes there");.println("Gaurd: 'Hault! Who goes there");.println("Gaurd: 'Hault! Who goes there");.println("Gaurd: 'Hault! Who goes there");.println("Gaurd: 'Hault! Who goes there");.println("Gaurd: 'Hault! Who goes there");.println("Gaurd: 'Hault! Who goes there"); System. System. System.out.println("You tell him your name and that you're a new advent".println("You tell him your name and that you're a new advent".println("You tell him your name and that you're a new advent".println("You tell him your name and that you're a new advent".println("You tell him your name and that you're a new advent".println("You tell him your name and that you're a new advent" + "urer"); + "urer"); + "urer"); + "urer"); + "urer"); + "urer"); + "urer"); + "urer"); System. System. System.out.println("Gaurd: 'Oh don't tell me, someone stole your sweet ".println("Gaurd: 'Oh don't tell me, someone stole your sweet ".println("Gaurd: 'Oh don't tell me, someone stole your sweet ".println("Gaurd: 'Oh don't tell me, someone stole your sweet ".println("Gaurd: 'Oh don't tell me, someone stole your sweet ".println("Gaurd: 'Oh don't tell me, someone stole your sweet " + "roll'"); + "roll'"); + "roll'"); + "roll'"); + "roll'"); + "roll'"); + "roll'"); + "roll'"); System. System. System.out.println("You look at him confused, he lets out a large sigh".println("You look at him confused, he lets out a large sigh".println("You look at him confused, he lets out a large sigh".println("You look at him confused, he lets out a large sigh".println("You look at him confused, he lets out a large sigh".println("You look at him confused, he lets out a large sigh" ); ); ); System. System. System.out.print("Gaurd: 'Alright");.print("Gaurd: 'Alright");.print("Gaurd: 'Alright");.print("Gaurd: 'Alright");.print("Gaurd: 'Alright");.print("Gaurd: 'Alright");.print("Gaurd: 'Alright");.print("Gaurd: 'Alright"); System. System. System.out.println(" Go on inside we have 2 math centers and a temperat".println(" Go on inside we have 2 math centers and a temperat".println(" Go on inside we have 2 math centers and a temperat".println(" Go on inside we have 2 math centers and a temperat".println(" Go on inside we have 2 math centers and a temperat".println(" Go on inside we have 2 math centers and a temperat" + "ure converter inside, enjoy yourself.'"); + "ure converter inside, enjoy yourself.'"); + "ure converter inside, enjoy yourself.'"); + "ure converter inside, enjoy yourself.'"); + "ure converter inside, enjoy yourself.'"); + "ure converter inside, enjoy yourself.'"); + "ure converter inside, enjoy yourself.'"); + "ure converter inside, enjoy yourself.'"); System. System. System.out.println("You walk inside and see the centers and the convert".println("You walk inside and see the centers and the convert".println("You walk inside and see the centers and the convert".println("You walk inside and see the centers and the convert".println("You walk inside and see the centers and the convert".println("You walk inside and see the centers and the convert" + "er."); + "er."); + "er."); + "er."); + "er."); + "er."); + "er."); + "er."); while (center != 4) { while (center != 4) { while (center != 4) { while (center != 4) { while (center != 4) { while (center != 4) { while (center != 4) { while (center != 4) { while (center != 4) { while (center != 4) { while (center != 4) { while (center != 4) { scan = 0; // reset scan at beginning of loop scan = 0; // reset scan at beginning of loop scan = 0; // reset scan at beginning of loop scan = 0; // reset scan at beginning of loop scan = 0; // reset scan at beginning of loop scan = 0; // reset scan at beginning of loop scan = 0; // reset scan at beginning of loop scan = 0; // reset scan at beginning of loop scan = 0; // reset scan at beginning of loop System. System. System.out.println("Where would you like to go? 1: math center 1, 2".println("Where would you like to go? 1: math center 1, 2".println("Where would you like to go? 1: math center 1, 2".println("Where would you like to go? 1: math center 1, 2".println("Where would you like to go? 1: math center 1, 2".println("Where would you like to go? 1: math center 1, 2" + ": math center 2, 3: temperature converter, or 4: leave?" + ": math center 2, 3: temperature converter, or 4: leave?" + ": math center 2, 3: temperature converter, or 4: leave?" + ": math center 2, 3: temperature converter, or 4: leave?" + ": math center 2, 3: temperature converter, or 4: leave?" + ": math center 2, 3: temperature converter, or 4: leave?" ); ); ); center = in.nextInt(); center = in.nextInt(); center = in.nextInt(); center = in.nextInt(); center = in.nextInt(); center = in.nextInt(); center = in.nextInt(); center = in.nextInt(); center = in.nextInt(); center = in.nextInt(); center = in.nextInt(); switch (center) { switch (center) { switch (center) { switch (center) { switch (center) { switch (center) { switch (center) { switch (center) { case 1: case 1: case 1: case 1: case 1: case 1: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { try { System. System. System.out.println("You enter the first math center".println("You enter the first math center".println("You enter the first math center".println("You enter the first math center".println("You enter the first math center".println("You enter the first math center" + " and you see a dog in the corner wagging" + " and you see a dog in the corner wagging" + " and you see a dog in the corner wagging" + " and you see a dog in the corner wagging" + " and you see a dog in the corner wagging" + " and you see a dog in the corner wagging" + " his tale"); + " his tale"); + " his tale"); + " his tale"); + " his tale"); + " his tale"); + " his tale"); + " his tale"); System. System. System.out.println("The writing on the wall asks yo".println("The writing on the wall asks yo".println("The writing on the wall asks yo".println("The writing on the wall asks yo".println("The writing on the wall asks yo".println("The writing on the wall asks yo" + "u to bark a few times and the dog will r" + "u to bark a few times and the dog will r" + "u to bark a few times and the dog will r" + "u to bark a few times and the dog will r" + "u to bark a few times and the dog will r" + "u to bark a few times and the dog will r" + "espond in barks"); + "espond in barks"); + "espond in barks"); + "espond in barks"); + "espond in barks"); + "espond in barks"); + "espond in barks"); + "espond in barks"); arithmeticOperations. arithmeticOperations. arithmeticOperations.arithmeticOperationsKing();();(); System. System. System.out.println("While impressive, this is utter".println("While impressive, this is utter".println("While impressive, this is utter".println("While impressive, this is utter".println("While impressive, this is utter".println("While impressive, this is utter" + "ly pointless, you go about your way."); + "ly pointless, you go about your way."); + "ly pointless, you go about your way."); + "ly pointless, you go about your way."); + "ly pointless, you go about your way."); + "ly pointless, you go about your way."); + "ly pointless, you go about your way."); + "ly pointless, you go about your way."); scan++; scan++; scan++; scan++; scan++; } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number"); } } } } break; break; break; case 2: case 2: case 2: case 2: case 2: case 2: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { System. System. System.out.println("You see a single vollyball sitt".println("You see a single vollyball sitt".println("You see a single vollyball sitt".println("You see a single vollyball sitt".println("You see a single vollyball sitt".println("You see a single vollyball sitt" + "ing on the floor."); + "ing on the floor."); + "ing on the floor."); + "ing on the floor."); + "ing on the floor."); + "ing on the floor."); + "ing on the floor."); + "ing on the floor."); System. System. System.out.println("The writing on the wall asks yo".println("The writing on the wall asks yo".println("The writing on the wall asks yo".println("The writing on the wall asks yo".println("The writing on the wall asks yo".println("The writing on the wall asks yo" + "u to jump a few times and the ball will " + "u to jump a few times and the ball will " + "u to jump a few times and the ball will " + "u to jump a few times and the ball will " + "u to jump a few times and the ball will " + "u to jump a few times and the ball will " + "respond in bounces"); + "respond in bounces"); + "respond in bounces"); + "respond in bounces"); + "respond in bounces"); + "respond in bounces"); + "respond in bounces"); + "respond in bounces"); arithmeticOperations2. arithmeticOperations2. arithmeticOperations2.arithmeticOperations2King();();(); System. System. System.out.println("You find this odd and unsettlin".println("You find this odd and unsettlin".println("You find this odd and unsettlin".println("You find this odd and unsettlin".println("You find this odd and unsettlin".println("You find this odd and unsettlin" + "g, you go about your way."); + "g, you go about your way."); + "g, you go about your way."); + "g, you go about your way."); + "g, you go about your way."); + "g, you go about your way."); + "g, you go about your way."); + "g, you go about your way."); scan++; scan++; scan++; scan++; scan++; } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) {

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/operations.java

1.1 of 2 2014.12.03 15:20:14

Page 58: Text adventure

737475767778798081828384858687888990919293949596979899100101102

} catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number"); } } } } break; break; break; case 3: case 3: case 3: case 3: case 3: case 3: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { System. System. System.out.println("You see storm from the X-men se".println("You see storm from the X-men se".println("You see storm from the X-men se".println("You see storm from the X-men se".println("You see storm from the X-men se".println("You see storm from the X-men se" + "ries standing in the middle of the room" + "ries standing in the middle of the room" + "ries standing in the middle of the room" + "ries standing in the middle of the room" + "ries standing in the middle of the room" + "ries standing in the middle of the room" + ""); + ""); + ""); + ""); + ""); + ""); System. System. System.out.println("Storm: 'Tell me what temperatur".println("Storm: 'Tell me what temperatur".println("Storm: 'Tell me what temperatur".println("Storm: 'Tell me what temperatur".println("Storm: 'Tell me what temperatur".println("Storm: 'Tell me what temperatur" + "e you want it to be, in celcius, and it " + "e you want it to be, in celcius, and it " + "e you want it to be, in celcius, and it " + "e you want it to be, in celcius, and it " + "e you want it to be, in celcius, and it " + "e you want it to be, in celcius, and it " + "shall be so'"); + "shall be so'"); + "shall be so'"); + "shall be so'"); + "shall be so'"); + "shall be so'"); + "shall be so'"); + "shall be so'"); cToF. cToF. cToF.cToFKing();();(); System. System. System.out.println("You ask storm why she's doing t".println("You ask storm why she's doing t".println("You ask storm why she's doing t".println("You ask storm why she's doing t".println("You ask storm why she's doing t".println("You ask storm why she's doing t" + "his instead of saving the world"); + "his instead of saving the world"); + "his instead of saving the world"); + "his instead of saving the world"); + "his instead of saving the world"); + "his instead of saving the world"); + "his instead of saving the world"); + "his instead of saving the world"); System. System. System.out.println("She gets upset with your inquir".println("She gets upset with your inquir".println("She gets upset with your inquir".println("She gets upset with your inquir".println("She gets upset with your inquir".println("She gets upset with your inquir" + "y and knocks you out of the room."); + "y and knocks you out of the room."); + "y and knocks you out of the room."); + "y and knocks you out of the room."); + "y and knocks you out of the room."); + "y and knocks you out of the room."); + "y and knocks you out of the room."); + "y and knocks you out of the room."); scan++; scan++; scan++; scan++; } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number"); } } } } break; break; break; } } } } } }}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/operations.java

2.1 of 2 2014.12.03 15:20:14

Page 59: Text adventure

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class palendromeCheck { {

public static void public static void public static void public static void public static void public static void public static void palendromeCheckKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in););

int length, start = 0, stop, between, i; int length, start = 0, stop, between, i; int length, start = 0, stop, between, i; int length, start = 0, stop, between, i; int length, start = 0, stop, between, i; int length, start = 0, stop, between, i; int length, start = 0, stop, between, i; int length, start = 0, stop, between, i; int length, start = 0, stop, between, i; int length, start = 0, stop, between, i; int length, start = 0, stop, between, i; int length, start = 0, stop, between, i; int length, start = 0, stop, between, i; int length, start = 0, stop, between, i; int length, start = 0, stop, between, i; int length, start = 0, stop, between, i; int length, start = 0, stop, between, i; int length, start = 0, stop, between, i; int length, start = 0, stop, between, i; int length, start = 0, stop, between, i; int length, start = 0, stop, between, i;

System. System. System.out.print("What word do you give them?");.print("What word do you give them?");.print("What word do you give them?");.print("What word do you give them?");.print("What word do you give them?");.print("What word do you give them?");.print("What word do you give them?");.print("What word do you give them?"); String line = in.nextLine(); String line = in.nextLine(); String line = in.nextLine(); String line = in.nextLine(); String line = in.nextLine(); String line = in.nextLine(); String line = in.nextLine(); String line = in.nextLine(); String line = in.nextLine(); String line = in.nextLine(); String line = in.nextLine(); String line = in.nextLine(); String line = in.nextLine(); length = line.length(); length = line.length(); length = line.length(); length = line.length(); length = line.length(); length = line.length(); length = line.length(); length = line.length(); length = line.length(); length = line.length(); length = line.length();

stop = length - 1; stop = length - 1; stop = length - 1; stop = length - 1; stop = length - 1; stop = length - 1; stop = length - 1; stop = length - 1; stop = length - 1; stop = length - 1; stop = length - 1; between = (start + stop) / 2; between = (start + stop) / 2; between = (start + stop) / 2; between = (start + stop) / 2; between = (start + stop) / 2; between = (start + stop) / 2; between = (start + stop) / 2; between = (start + stop) / 2; between = (start + stop) / 2; between = (start + stop) / 2; between = (start + stop) / 2; between = (start + stop) / 2; between = (start + stop) / 2; between = (start + stop) / 2; between = (start + stop) / 2; between = (start + stop) / 2; between = (start + stop) / 2;

/* scans the beginning and end of a sring to see if it's the same, stops /* 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*/ when it gets half way through on both ends*/ for (i = start; i <= between; i++) { for (i = start; i <= between; i++) { for (i = start; i <= between; i++) { for (i = start; i <= between; i++) { for (i = start; i <= between; i++) { for (i = start; i <= between; i++) { for (i = start; i <= between; i++) { for (i = start; i <= between; i++) { for (i = start; i <= between; i++) { for (i = start; i <= between; i++) { for (i = start; i <= between; i++) { for (i = start; i <= between; i++) { for (i = start; i <= between; i++) { for (i = start; i <= between; i++) { for (i = start; i <= between; i++) { for (i = start; i <= between; i++) { for (i = start; i <= between; i++) { for (i = start; i <= between; i++) { for (i = start; i <= between; i++) { for (i = start; i <= between; i++) { for (i = start; i <= between; i++) { for (i = start; i <= between; i++) { for (i = start; i <= between; i++) { if (line.charAt(start) == line.charAt(stop)) { if (line.charAt(start) == line.charAt(stop)) { if (line.charAt(start) == line.charAt(stop)) { if (line.charAt(start) == line.charAt(stop)) { if (line.charAt(start) == line.charAt(stop)) { if (line.charAt(start) == line.charAt(stop)) { if (line.charAt(start) == line.charAt(stop)) { if (line.charAt(start) == line.charAt(stop)) { if (line.charAt(start) == line.charAt(stop)) { if (line.charAt(start) == line.charAt(stop)) { if (line.charAt(start) == line.charAt(stop)) { if (line.charAt(start) == line.charAt(stop)) { if (line.charAt(start) == line.charAt(stop)) { if (line.charAt(start) == line.charAt(stop)) { if (line.charAt(start) == line.charAt(stop)) { if (line.charAt(start) == line.charAt(stop)) { if (line.charAt(start) == line.charAt(stop)) { if (line.charAt(start) == line.charAt(stop)) { if (line.charAt(start) == line.charAt(stop)) { if (line.charAt(start) == line.charAt(stop)) { if (line.charAt(start) == line.charAt(stop)) { if (line.charAt(start) == line.charAt(stop)) { start++; start++; start++; start++; stop--; stop--; stop--; stop--; } else { } else { } else { } else { } else { } else { break; break; break; } } } }

if (i == between + 1) { if (i == between + 1) { if (i == between + 1) { if (i == between + 1) { if (i == between + 1) { if (i == between + 1) { if (i == between + 1) { if (i == between + 1) { if (i == between + 1) { if (i == between + 1) { if (i == between + 1) { if (i == between + 1) { if (i == between + 1) { if (i == between + 1) { if (i == between + 1) { if (i == between + 1) { System. System. System.out.println("Carl: 'Class, is that a palendrome?'");.println("Carl: 'Class, is that a palendrome?'");.println("Carl: 'Class, is that a palendrome?'");.println("Carl: 'Class, is that a palendrome?'");.println("Carl: 'Class, is that a palendrome?'");.println("Carl: 'Class, is that a palendrome?'");.println("Carl: 'Class, is that a palendrome?'");.println("Carl: 'Class, is that a palendrome?'"); System. System. System.out.println("Class: 'Yes!'");.println("Class: 'Yes!'");.println("Class: 'Yes!'");.println("Class: 'Yes!'");.println("Class: 'Yes!'");.println("Class: 'Yes!'");.println("Class: 'Yes!'");.println("Class: 'Yes!'"); } else { } else { } else { } else { } else { } else { System. System. System.out.println("Carl: 'Class, is that a palendrome?'");.println("Carl: 'Class, is that a palendrome?'");.println("Carl: 'Class, is that a palendrome?'");.println("Carl: 'Class, is that a palendrome?'");.println("Carl: 'Class, is that a palendrome?'");.println("Carl: 'Class, is that a palendrome?'");.println("Carl: 'Class, is that a palendrome?'");.println("Carl: 'Class, is that a palendrome?'"); System. System. System.out.println("Class: 'NO!'");.println("Class: 'NO!'");.println("Class: 'NO!'");.println("Class: 'NO!'");.println("Class: 'NO!'");.println("Class: 'NO!'");.println("Class: 'NO!'");.println("Class: 'NO!'"); } } } }

}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/palendromeCheck.java

1.1 of 1 2014.12.03 14:05:54

Page 60: Text adventure

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

class class priceNameWeight { {

public static void public static void public static void public static void public static void public static void public static void priceNameWeightKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in); ); );

System. System. System.out.println("Lawer: 'Name a product");.println("Lawer: 'Name a product");.println("Lawer: 'Name a product");.println("Lawer: 'Name a product");.println("Lawer: 'Name a product");.println("Lawer: 'Name a product");.println("Lawer: 'Name a product");.println("Lawer: 'Name a product"); String name1 = in.nextLine(); String name1 = in.nextLine(); String name1 = in.nextLine(); String name1 = in.nextLine(); String name1 = in.nextLine(); String name1 = in.nextLine(); String name1 = in.nextLine(); String name1 = in.nextLine(); String name1 = in.nextLine(); String name1 = in.nextLine(); String name1 = in.nextLine(); String name1 = in.nextLine(); String name1 = in.nextLine(); System. System. System.out.println("Lawer: 'How much is it worth?");.println("Lawer: 'How much is it worth?");.println("Lawer: 'How much is it worth?");.println("Lawer: 'How much is it worth?");.println("Lawer: 'How much is it worth?");.println("Lawer: 'How much is it worth?");.println("Lawer: 'How much is it worth?");.println("Lawer: 'How much is it worth?"); double up = in.nextDouble(); double up = in.nextDouble(); double up = in.nextDouble(); double up = in.nextDouble(); double up = in.nextDouble(); double up = in.nextDouble(); double up = in.nextDouble(); double up = in.nextDouble(); double up = in.nextDouble(); double up = in.nextDouble(); double up = in.nextDouble(); double up = in.nextDouble(); double up = in.nextDouble(); System. System. System.out.println("Lawer: 'How many pounds of it will you be buying?");.println("Lawer: 'How many pounds of it will you be buying?");.println("Lawer: 'How many pounds of it will you be buying?");.println("Lawer: 'How many pounds of it will you be buying?");.println("Lawer: 'How many pounds of it will you be buying?");.println("Lawer: 'How many pounds of it will you be buying?");.println("Lawer: 'How many pounds of it will you be buying?");.println("Lawer: 'How many pounds of it will you be buying?"); double w = in.nextDouble(); double w = in.nextDouble(); double w = in.nextDouble(); double w = in.nextDouble(); double w = in.nextDouble(); double w = in.nextDouble(); double w = in.nextDouble(); double w = in.nextDouble(); double w = in.nextDouble(); double w = in.nextDouble(); double w = in.nextDouble(); double w = in.nextDouble(); double w = in.nextDouble(); WeighedItem item1 = new WeighedItem(); WeighedItem item1 = new WeighedItem(); WeighedItem item1 = new WeighedItem(); WeighedItem item1 = new WeighedItem(); WeighedItem item1 = new WeighedItem(); WeighedItem item1 = new WeighedItem(); WeighedItem item1 = new WeighedItem(); WeighedItem item1 = new WeighedItem(); WeighedItem item1 = new WeighedItem(); WeighedItem item1 = new WeighedItem(); WeighedItem item1 = new WeighedItem(); WeighedItem item1 = new WeighedItem(); WeighedItem item1 = new WeighedItem();

in.nextLine(); in.nextLine(); in.nextLine(); in.nextLine(); in.nextLine(); in.nextLine(); in.nextLine(); System. System. System.out.println("Lawer: 'Give me another product'");.println("Lawer: 'Give me another product'");.println("Lawer: 'Give me another product'");.println("Lawer: 'Give me another product'");.println("Lawer: 'Give me another product'");.println("Lawer: 'Give me another product'");.println("Lawer: 'Give me another product'");.println("Lawer: 'Give me another product'"); String name2 = in.nextLine(); String name2 = in.nextLine(); String name2 = in.nextLine(); String name2 = in.nextLine(); String name2 = in.nextLine(); String name2 = in.nextLine(); String name2 = in.nextLine(); String name2 = in.nextLine(); String name2 = in.nextLine(); String name2 = in.nextLine(); String name2 = in.nextLine(); String name2 = in.nextLine(); String name2 = in.nextLine(); System. System. System.out.println("Lawer: 'And it's price per unit?'");.println("Lawer: 'And it's price per unit?'");.println("Lawer: 'And it's price per unit?'");.println("Lawer: 'And it's price per unit?'");.println("Lawer: 'And it's price per unit?'");.println("Lawer: 'And it's price per unit?'");.println("Lawer: 'And it's price per unit?'");.println("Lawer: 'And it's price per unit?'"); double up1 = in.nextDouble(); double up1 = in.nextDouble(); double up1 = in.nextDouble(); double up1 = in.nextDouble(); double up1 = in.nextDouble(); double up1 = in.nextDouble(); double up1 = in.nextDouble(); double up1 = in.nextDouble(); double up1 = in.nextDouble(); double up1 = in.nextDouble(); double up1 = in.nextDouble(); double up1 = in.nextDouble(); double up1 = in.nextDouble(); System. System. System.out.println("Lawer: 'How many of those do you want?'");.println("Lawer: 'How many of those do you want?'");.println("Lawer: 'How many of those do you want?'");.println("Lawer: 'How many of those do you want?'");.println("Lawer: 'How many of those do you want?'");.println("Lawer: 'How many of those do you want?'");.println("Lawer: 'How many of those do you want?'");.println("Lawer: 'How many of those do you want?'"); int q = in.nextInt(); int q = in.nextInt(); int q = in.nextInt(); int q = in.nextInt(); int q = in.nextInt(); int q = in.nextInt(); int q = in.nextInt(); int q = in.nextInt(); int q = in.nextInt(); int q = in.nextInt(); int q = in.nextInt(); int q = in.nextInt(); int q = in.nextInt(); CountedItem item2 = new CountedItem(); CountedItem item2 = new CountedItem(); CountedItem item2 = new CountedItem(); CountedItem item2 = new CountedItem(); CountedItem item2 = new CountedItem(); CountedItem item2 = new CountedItem(); CountedItem item2 = new CountedItem(); CountedItem item2 = new CountedItem(); CountedItem item2 = new CountedItem(); CountedItem item2 = new CountedItem(); CountedItem item2 = new CountedItem(); CountedItem item2 = new CountedItem(); CountedItem item2 = new CountedItem(); item1.setName(name1); item1.setName(name1); item1.setName(name1); item1.setName(name1); item1.setName(name1); item1.setName(name1); item1.setName(name1); item1.setName(name1); item1.setName(name1); item1.setPrice(up); item1.setPrice(up); item1.setPrice(up); item1.setPrice(up); item1.setPrice(up); item1.setPrice(up); item1.setPrice(up); item1.setPrice(up); item1.setWeight(w); item1.setWeight(w); item1.setWeight(w); item1.setWeight(w); item1.setWeight(w); item1.setWeight(w); item1.setWeight(w); item1.setWeight(w); item1.getName(); item1.getName(); item1.getName(); item1.getName(); item1.getName(); item1.getName(); item1.getName(); item1.getPrice(); item1.getPrice(); item1.getPrice(); item1.getPrice(); item1.getPrice(); item1.getPrice(); item1.getPrice(); item1.getWeight(); item1.getWeight(); item1.getWeight(); item1.getWeight(); item1.getWeight(); item1.getWeight(); item1.getWeight(); item1.toString(); item1.toString(); item1.toString(); item1.toString(); item1.toString(); item1.toString(); item1.toString(); item2.setName(name2); item2.setName(name2); item2.setName(name2); item2.setName(name2); item2.setName(name2); item2.setName(name2); item2.setName(name2); item2.setName(name2); item2.setPrice(up1); item2.setPrice(up1); item2.setPrice(up1); item2.setPrice(up1); item2.setPrice(up1); item2.setPrice(up1); item2.setPrice(up1); item2.setPrice(up1); item2.setWeight(q); item2.setWeight(q); item2.setWeight(q); item2.setWeight(q); item2.setWeight(q); item2.setWeight(q); item2.setWeight(q); item2.setWeight(q); item2.getName(); item2.getName(); item2.getName(); item2.getName(); item2.getName(); item2.getName(); item2.getName(); item2.getPrice(); item2.getPrice(); item2.getPrice(); item2.getPrice(); item2.getPrice(); item2.getPrice(); item2.getPrice(); item2.getWeight(); item2.getWeight(); item2.getWeight(); item2.getWeight(); item2.getWeight(); item2.getWeight(); item2.getWeight(); item2.toString(); item2.toString(); item2.toString(); item2.toString(); item2.toString(); item2.toString(); item2.toString(); } }}

class class WeighedItem { {

private double weight; private double weight; private double weight; private double weight; private double weight; private double weight; private double weight; private double price; private double price; private double price; private double price; private double price; private double price; private double price; private String name; private String name; private String name; private String name; private String name; private String name; private String name; private double total; private double total; private double total; private double total; private double total; private double total; private double total;

public public public WeighedItem() {() {() {() {

} }

public void public void public void public void public void setWeight(double w) {(double w) {(double w) {(double w) {(double w) {(double w) {(double w) { weight = w; weight = w; weight = w; weight = w; weight = w; weight = w; weight = w; } }

public void public void public void public void public void setName(String name1) {(String name1) {(String name1) {(String name1) {(String name1) {(String name1) {(String name1) { name = name1; name = name1; name = name1; name = name1; name = name1; name = name1; name = name1;

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/priceNameWeight.java

1.1 of 3 2014.12.03 14:19:35

Page 61: Text adventure

737475767778798081828384858687888990919293

Page 62: Text adventure

145146147

} }}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/priceNameWeight.java

3.1 of 3 2014.12.03 14:19:35

Page 63: Text adventure

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class quadOfAngle { {

public static void public static void public static void public static void public static void public static void public static void quadOfAngleKing() {() {() {() { int angle = 0, scan = 0; int angle = 0, scan = 0; int angle = 0, scan = 0; int angle = 0, scan = 0; int angle = 0, scan = 0; int angle = 0, scan = 0; int angle = 0, scan = 0; int angle = 0, scan = 0; int angle = 0, scan = 0; int angle = 0, scan = 0; int angle = 0, scan = 0; int angle = 0, scan = 0; int angle = 0, scan = 0; int angle = 0, scan = 0; int angle = 0, scan = 0; int angle = 0, scan = 0; Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in);); System. System. System.out.println("Finnian: 'Oh! I know, give me an angle in degrees a".println("Finnian: 'Oh! I know, give me an angle in degrees a".println("Finnian: 'Oh! I know, give me an angle in degrees a".println("Finnian: 'Oh! I know, give me an angle in degrees a".println("Finnian: 'Oh! I know, give me an angle in degrees a".println("Finnian: 'Oh! I know, give me an angle in degrees a" + "nd whichever quadrant it's in I'll draw my circle there!"); + "nd whichever quadrant it's in I'll draw my circle there!"); + "nd whichever quadrant it's in I'll draw my circle there!"); + "nd whichever quadrant it's in I'll draw my circle there!"); + "nd whichever quadrant it's in I'll draw my circle there!"); + "nd whichever quadrant it's in I'll draw my circle there!"); + "nd whichever quadrant it's in I'll draw my circle there!"); + "nd whichever quadrant it's in I'll draw my circle there!"); // restricts the value of imput to between 0 and 360 // restricts the value of imput to between 0 and 360 while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { angle = in.nextInt(); angle = in.nextInt(); angle = in.nextInt(); angle = in.nextInt(); angle = in.nextInt(); angle = in.nextInt(); angle = in.nextInt(); angle = in.nextInt(); angle = in.nextInt(); angle = in.nextInt(); angle = in.nextInt(); if (angle < 0 || angle > 360) { if (angle < 0 || angle > 360) { if (angle < 0 || angle > 360) { if (angle < 0 || angle > 360) { if (angle < 0 || angle > 360) { if (angle < 0 || angle > 360) { if (angle < 0 || angle > 360) { if (angle < 0 || angle > 360) { if (angle < 0 || angle > 360) { if (angle < 0 || angle > 360) { if (angle < 0 || angle > 360) { if (angle < 0 || angle > 360) { if (angle < 0 || angle > 360) { if (angle < 0 || angle > 360) { if (angle < 0 || angle > 360) { if (angle < 0 || angle > 360) { if (angle < 0 || angle > 360) { if (angle < 0 || angle > 360) { if (angle < 0 || angle > 360) { if (angle < 0 || angle > 360) { System. System. System.out.println("Finnian: 'Please, only a number between 0 a".println("Finnian: 'Please, only a number between 0 a".println("Finnian: 'Please, only a number between 0 a".println("Finnian: 'Please, only a number between 0 a".println("Finnian: 'Please, only a number between 0 a".println("Finnian: 'Please, only a number between 0 a" + "nd 360.'"); + "nd 360.'"); + "nd 360.'"); + "nd 360.'"); + "nd 360.'"); + "nd 360.'"); + "nd 360.'"); + "nd 360.'"); } else { } else { } else { } else { } else { } else { scan++; scan++; scan++; scan++; } } } } int quadrant = 0; int quadrant = 0; int quadrant = 0; int quadrant = 0; int quadrant = 0; int quadrant = 0; int quadrant = 0; int quadrant = 0; int quadrant = 0;

if (angle < 90 && angle > 0) { if (angle < 90 && angle > 0) { if (angle < 90 && angle > 0) { if (angle < 90 && angle > 0) { if (angle < 90 && angle > 0) { if (angle < 90 && angle > 0) { if (angle < 90 && angle > 0) { if (angle < 90 && angle > 0) { if (angle < 90 && angle > 0) { if (angle < 90 && angle > 0) { if (angle < 90 && angle > 0) { if (angle < 90 && angle > 0) { if (angle < 90 && angle > 0) { if (angle < 90 && angle > 0) { if (angle < 90 && angle > 0) { if (angle < 90 && angle > 0) { if (angle < 90 && angle > 0) { if (angle < 90 && angle > 0) { if (angle < 90 && angle > 0) { if (angle < 90 && angle > 0) { quadrant = 1; quadrant = 1; quadrant = 1; quadrant = 1; quadrant = 1; quadrant = 1; quadrant = 1; } else if (angle < 180 && angle > 90) { } else if (angle < 180 && angle > 90) { } else if (angle < 180 && angle > 90) { } else if (angle < 180 && angle > 90) { } else if (angle < 180 && angle > 90) { } else if (angle < 180 && angle > 90) { } else if (angle < 180 && angle > 90) { } else if (angle < 180 && angle > 90) { } else if (angle < 180 && angle > 90) { } else if (angle < 180 && angle > 90) { } else if (angle < 180 && angle > 90) { } else if (angle < 180 && angle > 90) { } else if (angle < 180 && angle > 90) { } else if (angle < 180 && angle > 90) { } else if (angle < 180 && angle > 90) { } else if (angle < 180 && angle > 90) { } else if (angle < 180 && angle > 90) { } else if (angle < 180 && angle > 90) { } else if (angle < 180 && angle > 90) { } else if (angle < 180 && angle > 90) { } else if (angle < 180 && angle > 90) { } else if (angle < 180 && angle > 90) { } else if (angle < 180 && angle > 90) { } else if (angle < 180 && angle > 90) { quadrant = 2; quadrant = 2; quadrant = 2; quadrant = 2; quadrant = 2; quadrant = 2; quadrant = 2; } else if (angle < 270 && angle > 180) { } else if (angle < 270 && angle > 180) { } else if (angle < 270 && angle > 180) { } else if (angle < 270 && angle > 180) { } else if (angle < 270 && angle > 180) { } else if (angle < 270 && angle > 180) { } else if (angle < 270 && angle > 180) { } else if (angle < 270 && angle > 180) { } else if (angle < 270 && angle > 180) { } else if (angle < 270 && angle > 180) { } else if (angle < 270 && angle > 180) { } else if (angle < 270 && angle > 180) { } else if (angle < 270 && angle > 180) { } else if (angle < 270 && angle > 180) { } else if (angle < 270 && angle > 180) { } else if (angle < 270 && angle > 180) { } else if (angle < 270 && angle > 180) { } else if (angle < 270 && angle > 180) { } else if (angle < 270 && angle > 180) { } else if (angle < 270 && angle > 180) { } else if (angle < 270 && angle > 180) { } else if (angle < 270 && angle > 180) { } else if (angle < 270 && angle > 180) { } else if (angle < 270 && angle > 180) { quadrant = 3; quadrant = 3; quadrant = 3; quadrant = 3; quadrant = 3; quadrant = 3; quadrant = 3; } else if (angle < 360 && angle > 270) { } else if (angle < 360 && angle > 270) { } else if (angle < 360 && angle > 270) { } else if (angle < 360 && angle > 270) { } else if (angle < 360 && angle > 270) { } else if (angle < 360 && angle > 270) { } else if (angle < 360 && angle > 270) { } else if (angle < 360 && angle > 270) { } else if (angle < 360 && angle > 270) { } else if (angle < 360 && angle > 270) { } else if (angle < 360 && angle > 270) { } else if (angle < 360 && angle > 270) { } else if (angle < 360 && angle > 270) { } else if (angle < 360 && angle > 270) { } else if (angle < 360 && angle > 270) { } else if (angle < 360 && angle > 270) { } else if (angle < 360 && angle > 270) { } else if (angle < 360 && angle > 270) { } else if (angle < 360 && angle > 270) { } else if (angle < 360 && angle > 270) { } else if (angle < 360 && angle > 270) { } else if (angle < 360 && angle > 270) { } else if (angle < 360 && angle > 270) { } else if (angle < 360 && angle > 270) { quadrant = 4; quadrant = 4; quadrant = 4; quadrant = 4; quadrant = 4; quadrant = 4; quadrant = 4; } }

System. System. System.out.println("Finnian: 'That's it! I'm drawing my circle in the ".println("Finnian: 'That's it! I'm drawing my circle in the ".println("Finnian: 'That's it! I'm drawing my circle in the ".println("Finnian: 'That's it! I'm drawing my circle in the ".println("Finnian: 'That's it! I'm drawing my circle in the ".println("Finnian: 'That's it! I'm drawing my circle in the " + quadrant + " quadrant!'"); + quadrant + " quadrant!'"); + quadrant + " quadrant!'"); + quadrant + " quadrant!'"); + quadrant + " quadrant!'"); + quadrant + " quadrant!'"); + quadrant + " quadrant!'"); + quadrant + " quadrant!'"); + quadrant + " quadrant!'"); + quadrant + " quadrant!'"); + quadrant + " quadrant!'"); + quadrant + " quadrant!'"); } }

}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/quadOfAngle.java

1.1 of 1 2014.12.03 13:59:59

Page 64: Text adventure

12345678910111213141516171819202122232425262728293031323334

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class quadRoot { {

public static void public static void public static void public static void public static void public static void public static void quadRootKing() {() {() {() { Scanner scan = new Scanner(System. Scanner scan = new Scanner(System. Scanner scan = new Scanner(System. Scanner scan = new Scanner(System. Scanner scan = new Scanner(System. Scanner scan = new Scanner(System. Scanner scan = new Scanner(System. Scanner scan = new Scanner(System. Scanner scan = new Scanner(System. Scanner scan = new Scanner(System. Scanner scan = new Scanner(System. Scanner scan = new Scanner(System. Scanner scan = new Scanner(System.in);); System. System. System.out.println("What number do you wish the example to be?");.println("What number do you wish the example to be?");.println("What number do you wish the example to be?");.println("What number do you wish the example to be?");.println("What number do you wish the example to be?");.println("What number do you wish the example to be?");.println("What number do you wish the example to be?");.println("What number do you wish the example to be?"); double x = scan.nextDouble(); //x is the intiger/double double x = scan.nextDouble(); //x is the intiger/double double x = scan.nextDouble(); //x is the intiger/double double x = scan.nextDouble(); //x is the intiger/double double x = scan.nextDouble(); //x is the intiger/double double x = scan.nextDouble(); //x is the intiger/double double x = scan.nextDouble(); //x is the intiger/double double x = scan.nextDouble(); //x is the intiger/double double x = scan.nextDouble(); //x is the intiger/double double x = scan.nextDouble(); //x is the intiger/double double x = scan.nextDouble(); //x is the intiger/double double x = scan.nextDouble(); //x is the intiger/double double x = scan.nextDouble(); //x is the intiger/double double x = scan.nextDouble(); //x is the intiger/double double x = scan.nextDouble(); //x is the intiger/double double sqt = Math. double sqt = Math. double sqt = Math. double sqt = Math. double sqt = Math. double sqt = Math. double sqt = Math. double sqt = Math. double sqt = Math.sqrt(x);(x);(x);(x); double quadroot = Math. double quadroot = Math. double quadroot = Math. double quadroot = Math. double quadroot = Math. double quadroot = Math. double quadroot = Math. double quadroot = Math. double quadroot = Math.sqrt(sqt);(sqt);(sqt);(sqt); System. System. System.out.print("You explain how the square root is ");.print("You explain how the square root is ");.print("You explain how the square root is ");.print("You explain how the square root is ");.print("You explain how the square root is ");.print("You explain how the square root is ");.print("You explain how the square root is ");.print("You explain how the square root is "); System. System. System.out.printf("%.5f", sqt);.printf("%.5f", sqt);.printf("%.5f", sqt);.printf("%.5f", sqt);.printf("%.5f", sqt);.printf("%.5f", sqt);.printf("%.5f", sqt);.printf("%.5f", sqt);.printf("%.5f", sqt);.printf("%.5f", sqt);.printf("%.5f", sqt); //"%.nf" Is printing a doublt to n decimal places //"%.nf" Is printing a doublt to n decimal places System. System. System.out.println(""); //to add a line between result outputs.println(""); //to add a line between result outputs.println(""); //to add a line between result outputs.println(""); //to add a line between result outputs.println(""); //to add a line between result outputs.println(""); //to add a line between result outputs.println(""); //to add a line between result outputs.println(""); //to add a line between result outputs System. System. System.out.print("You explain how the quadratic root is ");.print("You explain how the quadratic root is ");.print("You explain how the quadratic root is ");.print("You explain how the quadratic root is ");.print("You explain how the quadratic root is ");.print("You explain how the quadratic root is ");.print("You explain how the quadratic root is ");.print("You explain how the quadratic root is "); System. System. System.out.printf("%.5f", quadroot);.printf("%.5f", quadroot);.printf("%.5f", quadroot);.printf("%.5f", quadroot);.printf("%.5f", quadroot);.printf("%.5f", quadroot);.printf("%.5f", quadroot);.printf("%.5f", quadroot);.printf("%.5f", quadroot);.printf("%.5f", quadroot);.printf("%.5f", quadroot); System. System. System.out.println("");.println("");.println("");.println("");.println("");.println("");

} }}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/quadRoot.java

1.1 of 1 2014.12.03 15:12:31

Page 65: Text adventure

1234567891011121314151617181920212223242526272829303132333435363738

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class absValue { {

public static void public static void public static void public static void public static void public static void public static void absValueKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in););

System. System. System.out.println("Which number do you wish to be the example?");.println("Which number do you wish to be the example?");.println("Which number do you wish to be the example?");.println("Which number do you wish to be the example?");.println("Which number do you wish to be the example?");.println("Which number do you wish to be the example?");.println("Which number do you wish to be the example?");.println("Which number do you wish to be the example?"); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); System. System. System.out.println("Which number do you wish to compare the first ".println("Which number do you wish to compare the first ".println("Which number do you wish to compare the first ".println("Which number do you wish to compare the first ".println("Which number do you wish to compare the first ".println("Which number do you wish to compare the first " + "number to?"); + "number to?"); + "number to?"); + "number to?"); + "number to?"); + "number to?"); + "number to?"); + "number to?"); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); if (Math. if (Math. if (Math. if (Math. if (Math. if (Math.abs(num1) == Math.(num1) == Math.(num1) == Math.(num1) == Math.(num1) == Math.(num1) == Math.(num1) == Math.(num1) == Math.abs(num2)) {(num2)) {(num2)) {(num2)) {(num2)) {(num2)) { //checks to see if the absolute value of num1 is the same as num2. //checks to see if the absolute value of num1 is the same as num2.

System. System. System.out.println("true, they are absolute values of one a".println("true, they are absolute values of one a".println("true, they are absolute values of one a".println("true, they are absolute values of one a".println("true, they are absolute values of one a".println("true, they are absolute values of one a" + "nother."); + "nother."); + "nother."); + "nother."); + "nother."); + "nother."); + "nother."); + "nother."); } else { } else { } else { } else { } else { } else { System. System. System.out.println("false, the are not absolute values.");.println("false, the are not absolute values.");.println("false, the are not absolute values.");.println("false, the are not absolute values.");.println("false, the are not absolute values.");.println("false, the are not absolute values.");.println("false, the are not absolute values.");.println("false, the are not absolute values."); } }

} }

}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/absValue.java

1.1 of 1 2014.12.03 15:13:46

Page 66: Text adventure

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class smallXLarge { {

public static void public static void public static void public static void public static void public static void public static void smallXLargeKing() {() {() {() {

Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in); // in because patterns); // in because patterns); // in because patterns); // in because patterns int sum = 0, luck = 50; int sum = 0, luck = 50; int sum = 0, luck = 50; int sum = 0, luck = 50; int sum = 0, luck = 50; int sum = 0, luck = 50; int sum = 0, luck = 50; int sum = 0, luck = 50; int sum = 0, luck = 50; int sum = 0, luck = 50; int sum = 0, luck = 50; int sum = 0, luck = 50; int sum = 0, luck = 50; int sum = 0, luck = 50; int sum = 0, luck = 50; int sum = 0, luck = 50; int a[]; int a[]; int a[]; int a[]; int a[]; int a[]; int a[]; a = new int[10]; a = new int[10]; a = new int[10]; a = new int[10]; a = new int[10]; a = new int[10]; a = new int[10]; a = new int[10]; a = new int[10]; a = new int[10]; a = new int[10]; a = new int[10]; System. System. System.out.println("woman: 'Alright love, just give me 10 numbers hm?'".println("woman: 'Alright love, just give me 10 numbers hm?'".println("woman: 'Alright love, just give me 10 numbers hm?'".println("woman: 'Alright love, just give me 10 numbers hm?'".println("woman: 'Alright love, just give me 10 numbers hm?'".println("woman: 'Alright love, just give me 10 numbers hm?'" + ""); + ""); + ""); + ""); + ""); + ""); for (int i = 0; i < 10; i++) { // fills the array for (int i = 0; i < 10; i++) { // fills the array for (int i = 0; i < 10; i++) { // fills the array for (int i = 0; i < 10; i++) { // fills the array for (int i = 0; i < 10; i++) { // fills the array for (int i = 0; i < 10; i++) { // fills the array for (int i = 0; i < 10; i++) { // fills the array for (int i = 0; i < 10; i++) { // fills the array for (int i = 0; i < 10; i++) { // fills the array for (int i = 0; i < 10; i++) { // fills the array for (int i = 0; i < 10; i++) { // fills the array for (int i = 0; i < 10; i++) { // fills the array for (int i = 0; i < 10; i++) { // fills the array for (int i = 0; i < 10; i++) { // fills the array for (int i = 0; i < 10; i++) { // fills the array for (int i = 0; i < 10; i++) { // fills the array for (int i = 0; i < 10; i++) { // fills the array for (int i = 0; i < 10; i++) { // fills the array for (int i = 0; i < 10; i++) { // fills the array for (int i = 0; i < 10; i++) { // fills the array for (int i = 0; i < 10; i++) { // fills the array for (int i = 0; i < 10; i++) { // fills the array for (int i = 0; i < 10; i++) { // fills the array for (int i = 0; i < 10; i++) { // fills the array for (int i = 0; i < 10; i++) { // fills the array for (int i = 0; i < 10; i++) { // fills the array for (int i = 0; i < 10; i++) { // fills the array a[i] = in.nextInt(); a[i] = in.nextInt(); a[i] = in.nextInt(); a[i] = in.nextInt(); a[i] = in.nextInt(); a[i] = in.nextInt(); a[i] = in.nextInt(); a[i] = in.nextInt(); a[i] = in.nextInt(); a[i] = in.nextInt(); a[i] = in.nextInt(); a[i] = in.nextInt(); a[i] = in.nextInt(); a[i] = in.nextInt(); } } int min = a[0]; int min = a[0]; int min = a[0]; int min = a[0]; int min = a[0]; int min = a[0]; int min = a[0]; int min = a[0]; int min = a[0]; int min = a[0]; int min = a[0]; int min = a[0]; int max = a[0]; int max = a[0]; int max = a[0]; int max = a[0]; int max = a[0]; int max = a[0]; int max = a[0]; int max = a[0]; int max = a[0]; int max = a[0]; int max = a[0]; int max = a[0]; for (int counter = 1; counter < a.length; counter++) { for (int counter = 1; counter < a.length; counter++) { for (int counter = 1; counter < a.length; counter++) { for (int counter = 1; counter < a.length; counter++) { for (int counter = 1; counter < a.length; counter++) { for (int counter = 1; counter < a.length; counter++) { for (int counter = 1; counter < a.length; counter++) { for (int counter = 1; counter < a.length; counter++) { for (int counter = 1; counter < a.length; counter++) { for (int counter = 1; counter < a.length; counter++) { for (int counter = 1; counter < a.length; counter++) { for (int counter = 1; counter < a.length; counter++) { for (int counter = 1; counter < a.length; counter++) { for (int counter = 1; counter < a.length; counter++) { for (int counter = 1; counter < a.length; counter++) { for (int counter = 1; counter < a.length; counter++) { for (int counter = 1; counter < a.length; counter++) { for (int counter = 1; counter < a.length; counter++) { for (int counter = 1; counter < a.length; counter++) { for (int counter = 1; counter < a.length; counter++) { for (int counter = 1; counter < a.length; counter++) { for (int counter = 1; counter < a.length; counter++) { for (int counter = 1; counter < a.length; counter++) { for (int counter = 1; counter < a.length; counter++) { for (int counter = 1; counter < a.length; counter++) { for (int counter = 1; counter < a.length; counter++) { for (int counter = 1; counter < a.length; counter++) { if (max < a[counter]) { /* if a[counter] is bigger than the number if (max < a[counter]) { /* if a[counter] is bigger than the number if (max < a[counter]) { /* if a[counter] is bigger than the number if (max < a[counter]) { /* if a[counter] is bigger than the number if (max < a[counter]) { /* if a[counter] is bigger than the number if (max < a[counter]) { /* if a[counter] is bigger than the number if (max < a[counter]) { /* if a[counter] is bigger than the number if (max < a[counter]) { /* if a[counter] is bigger than the number if (max < a[counter]) { /* if a[counter] is bigger than the number if (max < a[counter]) { /* if a[counter] is bigger than the number if (max < a[counter]) { /* if a[counter] is bigger than the number if (max < a[counter]) { /* if a[counter] is bigger than the number if (max < a[counter]) { /* if a[counter] is bigger than the number if (max < a[counter]) { /* if a[counter] is bigger than the number if (max < a[counter]) { /* if a[counter] is bigger than the number if (max < a[counter]) { /* if a[counter] is bigger than the number if (max < a[counter]) { /* if a[counter] is bigger than the number alreasy assigned to max replace max with said value.*/ alreasy assigned to max replace max with said value.*/

max = a[counter]; max = a[counter]; max = a[counter]; max = a[counter]; max = a[counter]; max = a[counter]; max = a[counter]; max = a[counter]; max = a[counter]; max = a[counter]; } } if (min > a[counter]) {/* if a[counter] is smaller than the number if (min > a[counter]) {/* if a[counter] is smaller than the number if (min > a[counter]) {/* if a[counter] is smaller than the number if (min > a[counter]) {/* if a[counter] is smaller than the number if (min > a[counter]) {/* if a[counter] is smaller than the number if (min > a[counter]) {/* if a[counter] is smaller than the number if (min > a[counter]) {/* if a[counter] is smaller than the number if (min > a[counter]) {/* if a[counter] is smaller than the number if (min > a[counter]) {/* if a[counter] is smaller than the number if (min > a[counter]) {/* if a[counter] is smaller than the number if (min > a[counter]) {/* if a[counter] is smaller than the number if (min > a[counter]) {/* if a[counter] is smaller than the number if (min > a[counter]) {/* if a[counter] is smaller than the number if (min > a[counter]) {/* if a[counter] is smaller than the number if (min > a[counter]) {/* if a[counter] is smaller than the number if (min > a[counter]) {/* if a[counter] is smaller than the number alreasy assigned to min replace min with said value.*/ alreasy assigned to min replace min with said value.*/

min = a[counter]; min = a[counter]; min = a[counter]; min = a[counter]; min = a[counter]; min = a[counter]; min = a[counter]; min = a[counter]; min = a[counter]; min = a[counter]; } } } }

System. System. System.out.println("Woman: 'Oh the fortune i'm getting is the number ".println("Woman: 'Oh the fortune i'm getting is the number ".println("Woman: 'Oh the fortune i'm getting is the number ".println("Woman: 'Oh the fortune i'm getting is the number ".println("Woman: 'Oh the fortune i'm getting is the number ".println("Woman: 'Oh the fortune i'm getting is the number " + "" + (max * min)); + "" + (max * min)); + "" + (max * min)); + "" + (max * min)); + "" + (max * min)); + "" + (max * min)); + "" + (max * min)); + "" + (max * min)); + "" + (max * min)); + "" + (max * min)); + "" + (max * min)); + "" + (max * min)); + "" + (max * min)); + "" + (max * min)); + "" + (max * min)); + "" + (max * min)); if (max * min == 0) { if (max * min == 0) { if (max * min == 0) { if (max * min == 0) { if (max * min == 0) { if (max * min == 0) { if (max * min == 0) { if (max * min == 0) { if (max * min == 0) { if (max * min == 0) { if (max * min == 0) { if (max * min == 0) { if (max * min == 0) { if (max * min == 0) { if (max * min == 0) { if (max * min == 0) { System. System. System.out.println("Woman: Sorry hun, you're going to die in your s".println("Woman: Sorry hun, you're going to die in your s".println("Woman: Sorry hun, you're going to die in your s".println("Woman: Sorry hun, you're going to die in your s".println("Woman: Sorry hun, you're going to die in your s".println("Woman: Sorry hun, you're going to die in your s" + "leep tonight."); + "leep tonight."); + "leep tonight."); + "leep tonight."); + "leep tonight."); + "leep tonight."); + "leep tonight."); + "leep tonight."); } else if (max * min < luck && max * min > 0) { } else if (max * min < luck && max * min > 0) { } else if (max * min < luck && max * min > 0) { } else if (max * min < luck && max * min > 0) { } else if (max * min < luck && max * min > 0) { } else if (max * min < luck && max * min > 0) { } else if (max * min < luck && max * min > 0) { } else if (max * min < luck && max * min > 0) { } else if (max * min < luck && max * min > 0) { } else if (max * min < luck && max * min > 0) { } else if (max * min < luck && max * min > 0) { } else if (max * min < luck && max * min > 0) { } else if (max * min < luck && max * min > 0) { } else if (max * min < luck && max * min > 0) { } else if (max * min < luck && max * min > 0) { } else if (max * min < luck && max * min > 0) { } else if (max * min < luck && max * min > 0) { } else if (max * min < luck && max * min > 0) { } else if (max * min < luck && max * min > 0) { } else if (max * min < luck && max * min > 0) { } else if (max * min < luck && max * min > 0) { } else if (max * min < luck && max * min > 0) { } else if (max * min < luck && max * min > 0) { } else if (max * min < luck && max * min > 0) { } else if (max * min < luck && max * min > 0) { } else if (max * min < luck && max * min > 0) { } else if (max * min < luck && max * min > 0) { } else if (max * min < luck && max * min > 0) { } else if (max * min < luck && max * min > 0) { } else if (max * min < luck && max * min > 0) { } else if (max * min < luck && max * min > 0) { } else if (max * min < luck && max * min > 0) { System. System. System.out.println("Woman: 'Oh my deer boy you have bad luck, but y".println("Woman: 'Oh my deer boy you have bad luck, but y".println("Woman: 'Oh my deer boy you have bad luck, but y".println("Woman: 'Oh my deer boy you have bad luck, but y".println("Woman: 'Oh my deer boy you have bad luck, but y".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" + "ou will live into yout 30's, after that the person you l" + "ou will live into yout 30's, after that the person you l" + "ou will live into yout 30's, after that the person you l" + "ou will live into yout 30's, after that the person you l" + "ou will live into yout 30's, after that the person you l" + "ove most will kill you.'"); + "ove most will kill you.'"); + "ove most will kill you.'"); + "ove most will kill you.'"); + "ove most will kill you.'"); + "ove most will kill you.'"); + "ove most will kill you.'"); + "ove most will kill you.'");

} else if (max * min > luck) { } else if (max * min > luck) { } else if (max * min > luck) { } else if (max * min > luck) { } else if (max * min > luck) { } else if (max * min > luck) { } else if (max * min > luck) { } else if (max * min > luck) { } else if (max * min > luck) { } else if (max * min > luck) { } else if (max * min > luck) { } else if (max * min > luck) { } else if (max * min > luck) { } else if (max * min > luck) { } else if (max * min > luck) { } else if (max * min > luck) { } else if (max * min > luck) { } else if (max * min > luck) { } else if (max * min > luck) { } else if (max * min > luck) { System. System. System.out.println("Woman: 'Oh you have good luck, I'm glad to see ".println("Woman: 'Oh you have good luck, I'm glad to see ".println("Woman: 'Oh you have good luck, I'm glad to see ".println("Woman: 'Oh you have good luck, I'm glad to see ".println("Woman: 'Oh you have good luck, I'm glad to see ".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" + "that for once one of the people on this ship aren't goin" + "that for once one of the people on this ship aren't goin" + "that for once one of the people on this ship aren't goin" + "that for once one of the people on this ship aren't goin" + "that for once one of the people on this ship aren't goin" + "g to die soon."); + "g to die soon."); + "g to die soon."); + "g to die soon."); + "g to die soon."); + "g to die soon."); + "g to die soon."); + "g to die soon.");

} } } }}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/smallXLarge.java

1.1 of 2 2014.12.03 14:30:11

Page 67: Text adventure

62

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/smallXLarge.java

2.1 of 2 2014.12.03 14:30:11

Page 68: Text adventure

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class spaceWeight { {

public static void public static void public static void public static void public static void public static void public static void spaceWeightKing() {() {() {() { double weight; double weight; double weight; double weight; double weight;

int opt; int opt; int opt; int opt; int opt;

Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in); // in because patterns); // in because patterns); // in because patterns); // in because patterns

System. System. System.out.print("Please enter your current earth weight. ".print("Please enter your current earth weight. ".print("Please enter your current earth weight. ".print("Please enter your current earth weight. ".print("Please enter your current earth weight. ".print("Please enter your current earth weight. " + "The machine says."); + "The machine says."); + "The machine says."); + "The machine says."); + "The machine says."); + "The machine says."); + "The machine says."); + "The machine says.");

weight = in.nextFloat(); weight = in.nextFloat(); weight = in.nextFloat(); weight = in.nextFloat(); weight = in.nextFloat(); weight = in.nextFloat(); weight = in.nextFloat(); weight = in.nextFloat(); weight = in.nextFloat(); weight = in.nextFloat(); weight = in.nextFloat();

System. System. System.out.println();.println();.println();.println();.println();

System. System. System.out.println("I have information for the following planets :");.println("I have information for the following planets :");.println("I have information for the following planets :");.println("I have information for the following planets :");.println("I have information for the following planets :");.println("I have information for the following planets :");.println("I have information for the following planets :");.println("I have information for the following planets :");

System. System. System.out.println("1.Venus 2.Mars 3.Jupiter 4.Saturn 5.Uranus".println("1.Venus 2.Mars 3.Jupiter 4.Saturn 5.Uranus".println("1.Venus 2.Mars 3.Jupiter 4.Saturn 5.Uranus".println("1.Venus 2.Mars 3.Jupiter 4.Saturn 5.Uranus".println("1.Venus 2.Mars 3.Jupiter 4.Saturn 5.Uranus".println("1.Venus 2.Mars 3.Jupiter 4.Saturn 5.Uranus" + " 6.Neptune, which planet are you visiting?"); + " 6.Neptune, which planet are you visiting?"); + " 6.Neptune, which planet are you visiting?"); + " 6.Neptune, which planet are you visiting?"); + " 6.Neptune, which planet are you visiting?"); + " 6.Neptune, which planet are you visiting?"); + " 6.Neptune, which planet are you visiting?"); + " 6.Neptune, which planet are you visiting?");

opt = in.nextInt(); opt = in.nextInt(); opt = in.nextInt(); opt = in.nextInt(); opt = in.nextInt(); opt = in.nextInt(); opt = in.nextInt(); opt = in.nextInt(); opt = in.nextInt(); opt = in.nextInt(); opt = in.nextInt();

double venus, mars, jupiter, saturn, uranus, neptune; double venus, mars, jupiter, saturn, uranus, neptune; double venus, mars, jupiter, saturn, uranus, neptune; double venus, mars, jupiter, saturn, uranus, neptune; double venus, mars, jupiter, saturn, uranus, neptune; double venus, mars, jupiter, saturn, uranus, neptune; double venus, mars, jupiter, saturn, uranus, neptune; double venus, mars, jupiter, saturn, uranus, neptune; double venus, mars, jupiter, saturn, uranus, neptune; double venus, mars, jupiter, saturn, uranus, neptune; double venus, mars, jupiter, saturn, uranus, neptune; double venus, mars, jupiter, saturn, uranus, neptune; double venus, mars, jupiter, saturn, uranus, neptune; double venus, mars, jupiter, saturn, uranus, neptune; double venus, mars, jupiter, saturn, uranus, neptune; double venus, mars, jupiter, saturn, uranus, neptune; double venus, mars, jupiter, saturn, uranus, neptune; double venus, mars, jupiter, saturn, uranus, neptune; double venus, mars, jupiter, saturn, uranus, neptune; double venus, mars, jupiter, saturn, uranus, neptune;

venus = weight * 0.78; // 0.78 is the relitive gravity on venus venus = weight * 0.78; // 0.78 is the relitive gravity on venus venus = weight * 0.78; // 0.78 is the relitive gravity on venus venus = weight * 0.78; // 0.78 is the relitive gravity on venus venus = weight * 0.78; // 0.78 is the relitive gravity on venus venus = weight * 0.78; // 0.78 is the relitive gravity on venus venus = weight * 0.78; // 0.78 is the relitive gravity on venus venus = weight * 0.78; // 0.78 is the relitive gravity on venus venus = weight * 0.78; // 0.78 is the relitive gravity on venus venus = weight * 0.78; // 0.78 is the relitive gravity on venus venus = weight * 0.78; // 0.78 is the relitive gravity on venus venus = weight * 0.78; // 0.78 is the relitive gravity on venus venus = weight * 0.78; // 0.78 is the relitive gravity on venus mars = weight * 0.39; // 0.39 is the relative gravity on mars mars = weight * 0.39; // 0.39 is the relative gravity on mars mars = weight * 0.39; // 0.39 is the relative gravity on mars mars = weight * 0.39; // 0.39 is the relative gravity on mars mars = weight * 0.39; // 0.39 is the relative gravity on mars mars = weight * 0.39; // 0.39 is the relative gravity on mars mars = weight * 0.39; // 0.39 is the relative gravity on mars mars = weight * 0.39; // 0.39 is the relative gravity on mars mars = weight * 0.39; // 0.39 is the relative gravity on mars mars = weight * 0.39; // 0.39 is the relative gravity on mars mars = weight * 0.39; // 0.39 is the relative gravity on mars mars = weight * 0.39; // 0.39 is the relative gravity on mars mars = weight * 0.39; // 0.39 is the relative gravity on mars jupiter = weight * 2.65; // 2.65 is the relative gravity on jupiter jupiter = weight * 2.65; // 2.65 is the relative gravity on jupiter jupiter = weight * 2.65; // 2.65 is the relative gravity on jupiter jupiter = weight * 2.65; // 2.65 is the relative gravity on jupiter jupiter = weight * 2.65; // 2.65 is the relative gravity on jupiter jupiter = weight * 2.65; // 2.65 is the relative gravity on jupiter jupiter = weight * 2.65; // 2.65 is the relative gravity on jupiter jupiter = weight * 2.65; // 2.65 is the relative gravity on jupiter jupiter = weight * 2.65; // 2.65 is the relative gravity on jupiter jupiter = weight * 2.65; // 2.65 is the relative gravity on jupiter jupiter = weight * 2.65; // 2.65 is the relative gravity on jupiter jupiter = weight * 2.65; // 2.65 is the relative gravity on jupiter jupiter = weight * 2.65; // 2.65 is the relative gravity on jupiter saturn = weight * 1.17; // 1.17 is the relative gravity on saturn saturn = weight * 1.17; // 1.17 is the relative gravity on saturn saturn = weight * 1.17; // 1.17 is the relative gravity on saturn saturn = weight * 1.17; // 1.17 is the relative gravity on saturn saturn = weight * 1.17; // 1.17 is the relative gravity on saturn saturn = weight * 1.17; // 1.17 is the relative gravity on saturn saturn = weight * 1.17; // 1.17 is the relative gravity on saturn saturn = weight * 1.17; // 1.17 is the relative gravity on saturn saturn = weight * 1.17; // 1.17 is the relative gravity on saturn saturn = weight * 1.17; // 1.17 is the relative gravity on saturn saturn = weight * 1.17; // 1.17 is the relative gravity on saturn saturn = weight * 1.17; // 1.17 is the relative gravity on saturn saturn = weight * 1.17; // 1.17 is the relative gravity on saturn uranus = weight * 1.05; // 1.05 is the relative gravity on uranus uranus = weight * 1.05; // 1.05 is the relative gravity on uranus uranus = weight * 1.05; // 1.05 is the relative gravity on uranus uranus = weight * 1.05; // 1.05 is the relative gravity on uranus uranus = weight * 1.05; // 1.05 is the relative gravity on uranus uranus = weight * 1.05; // 1.05 is the relative gravity on uranus uranus = weight * 1.05; // 1.05 is the relative gravity on uranus uranus = weight * 1.05; // 1.05 is the relative gravity on uranus uranus = weight * 1.05; // 1.05 is the relative gravity on uranus uranus = weight * 1.05; // 1.05 is the relative gravity on uranus uranus = weight * 1.05; // 1.05 is the relative gravity on uranus uranus = weight * 1.05; // 1.05 is the relative gravity on uranus uranus = weight * 1.05; // 1.05 is the relative gravity on uranus neptune = weight * 1.23; // 1.23 is the relative gravity on neptune neptune = weight * 1.23; // 1.23 is the relative gravity on neptune neptune = weight * 1.23; // 1.23 is the relative gravity on neptune neptune = weight * 1.23; // 1.23 is the relative gravity on neptune neptune = weight * 1.23; // 1.23 is the relative gravity on neptune neptune = weight * 1.23; // 1.23 is the relative gravity on neptune neptune = weight * 1.23; // 1.23 is the relative gravity on neptune neptune = weight * 1.23; // 1.23 is the relative gravity on neptune neptune = weight * 1.23; // 1.23 is the relative gravity on neptune neptune = weight * 1.23; // 1.23 is the relative gravity on neptune neptune = weight * 1.23; // 1.23 is the relative gravity on neptune neptune = weight * 1.23; // 1.23 is the relative gravity on neptune neptune = weight * 1.23; // 1.23 is the relative gravity on neptune switch (opt) { switch (opt) { switch (opt) { switch (opt) { switch (opt) { switch (opt) { switch (opt) { switch (opt) { case 1: case 1: case 1: case 1: case 1: System. System. System.out.println("The little man holds up number cards ".println("The little man holds up number cards ".println("The little man holds up number cards ".println("The little man holds up number cards ".println("The little man holds up number cards ".println("The little man holds up number cards " + "that read: Your weight in pounds is :" + venus); + "that read: Your weight in pounds is :" + venus); + "that read: Your weight in pounds is :" + venus); + "that read: Your weight in pounds is :" + venus); + "that read: Your weight in pounds is :" + venus); + "that read: Your weight in pounds is :" + venus); + "that read: Your weight in pounds is :" + venus); + "that read: Your weight in pounds is :" + venus); + "that read: Your weight in pounds is :" + venus); + "that read: Your weight in pounds is :" + venus); + "that read: Your weight in pounds is :" + venus); + "that read: Your weight in pounds is :" + venus); break; break; break; case 2: case 2: case 2: case 2: case 2: System. System. System.out.println("The little man holds up number cards ".println("The little man holds up number cards ".println("The little man holds up number cards ".println("The little man holds up number cards ".println("The little man holds up number cards ".println("The little man holds up number cards " + "that read: Your weight in pounds is :" + mars); + "that read: Your weight in pounds is :" + mars); + "that read: Your weight in pounds is :" + mars); + "that read: Your weight in pounds is :" + mars); + "that read: Your weight in pounds is :" + mars); + "that read: Your weight in pounds is :" + mars); + "that read: Your weight in pounds is :" + mars); + "that read: Your weight in pounds is :" + mars); + "that read: Your weight in pounds is :" + mars); + "that read: Your weight in pounds is :" + mars); + "that read: Your weight in pounds is :" + mars); + "that read: Your weight in pounds is :" + mars); break; break; break; case 3: case 3: case 3: case 3: case 3: System. System. System.out.println("The little man holds up number cards ".println("The little man holds up number cards ".println("The little man holds up number cards ".println("The little man holds up number cards ".println("The little man holds up number cards ".println("The little man holds up number cards " + "that read: Your weight in pounds is :" + jupiter); + "that read: Your weight in pounds is :" + jupiter); + "that read: Your weight in pounds is :" + jupiter); + "that read: Your weight in pounds is :" + jupiter); + "that read: Your weight in pounds is :" + jupiter); + "that read: Your weight in pounds is :" + jupiter); + "that read: Your weight in pounds is :" + jupiter); + "that read: Your weight in pounds is :" + jupiter); + "that read: Your weight in pounds is :" + jupiter); + "that read: Your weight in pounds is :" + jupiter); + "that read: Your weight in pounds is :" + jupiter); + "that read: Your weight in pounds is :" + jupiter); break; break; break; case 4: case 4: case 4: case 4: case 4: System. System. System.out.println("The little man holds up number cards ".println("The little man holds up number cards ".println("The little man holds up number cards ".println("The little man holds up number cards ".println("The little man holds up number cards ".println("The little man holds up number cards " + "that read: Your weight in pounds is :" + saturn); + "that read: Your weight in pounds is :" + saturn); + "that read: Your weight in pounds is :" + saturn); + "that read: Your weight in pounds is :" + saturn); + "that read: Your weight in pounds is :" + saturn); + "that read: Your weight in pounds is :" + saturn); + "that read: Your weight in pounds is :" + saturn); + "that read: Your weight in pounds is :" + saturn); + "that read: Your weight in pounds is :" + saturn); + "that read: Your weight in pounds is :" + saturn); + "that read: Your weight in pounds is :" + saturn); + "that read: Your weight in pounds is :" + saturn); break; break; break; case 5: case 5: case 5: case 5: case 5: System. System. System.out.println("The little man holds up number cards ".println("The little man holds up number cards ".println("The little man holds up number cards ".println("The little man holds up number cards ".println("The little man holds up number cards ".println("The little man holds up number cards " + "that read: Your weight in pounds is :" + uranus); + "that read: Your weight in pounds is :" + uranus); + "that read: Your weight in pounds is :" + uranus); + "that read: Your weight in pounds is :" + uranus); + "that read: Your weight in pounds is :" + uranus); + "that read: Your weight in pounds is :" + uranus); + "that read: Your weight in pounds is :" + uranus); + "that read: Your weight in pounds is :" + uranus); + "that read: Your weight in pounds is :" + uranus); + "that read: Your weight in pounds is :" + uranus); + "that read: Your weight in pounds is :" + uranus); + "that read: Your weight in pounds is :" + uranus); break; break; break; case 6: case 6: case 6: case 6: case 6: System. System. System.out.println("The little man holds up number cards ".println("The little man holds up number cards ".println("The little man holds up number cards ".println("The little man holds up number cards ".println("The little man holds up number cards ".println("The little man holds up number cards " + "that read: Your weight in pounds is :" + neptune); + "that read: Your weight in pounds is :" + neptune); + "that read: Your weight in pounds is :" + neptune); + "that read: Your weight in pounds is :" + neptune); + "that read: Your weight in pounds is :" + neptune); + "that read: Your weight in pounds is :" + neptune); + "that read: Your weight in pounds is :" + neptune); + "that read: Your weight in pounds is :" + neptune); + "that read: Your weight in pounds is :" + neptune); + "that read: Your weight in pounds is :" + neptune); + "that read: Your weight in pounds is :" + neptune); + "that read: Your weight in pounds is :" + neptune); break; break; break; } } } }

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/spaceWeight.java

1.1 of 2 2014.12.03 15:08:36

Page 69: Text adventure

737475

} }}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/spaceWeight.java

2.1 of 2 2014.12.03 15:08:36

Page 70: Text adventure

12345678910111213141516171819202122232425262728293031323334353637

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class squareRootM { {

public static double public static double public static double public static double public static double public static double public static double number, , answer;

public static void public static void public static void public static void public static void public static void public static void calculateSquare(double number) {(double number) {(double number) {(double number) {(double number) {(double number) {(double number) { answer = Math. = Math. = Math. = Math. = Math.sqrt(number);(number);(number);(number); System. System. System.out.println("The chained man answers: " + (int) .println("The chained man answers: " + (int) .println("The chained man answers: " + (int) .println("The chained man answers: " + (int) .println("The chained man answers: " + (int) .println("The chained man answers: " + (int) .println("The chained man answers: " + (int) .println("The chained man answers: " + (int) .println("The chained man answers: " + (int) .println("The chained man answers: " + (int) .println("The chained man answers: " + (int) .println("The chained man answers: " + (int) .println("The chained man answers: " + (int) answer);); System. System. System.out.println("Assassin: 'Good, he is ready, thank you.'");.println("Assassin: 'Good, he is ready, thank you.'");.println("Assassin: 'Good, he is ready, thank you.'");.println("Assassin: 'Good, he is ready, thank you.'");.println("Assassin: 'Good, he is ready, thank you.'");.println("Assassin: 'Good, he is ready, thank you.'");.println("Assassin: 'Good, he is ready, thank you.'");.println("Assassin: 'Good, he is ready, thank you.'"); } }

public static void public static void public static void public static void public static void public static void public static void squareRootMKing() {() {() {() {

squareRootM challenge = new squareRootM(); squareRootM challenge = new squareRootM(); squareRootM challenge = new squareRootM(); squareRootM challenge = new squareRootM(); squareRootM challenge = new squareRootM(); squareRootM challenge = new squareRootM(); squareRootM challenge = new squareRootM(); squareRootM challenge = new squareRootM(); squareRootM challenge = new squareRootM(); squareRootM challenge = new squareRootM(); squareRootM challenge = new squareRootM(); squareRootM challenge = new squareRootM(); squareRootM challenge = new squareRootM(); final Scanner in = new Scanner(System. final Scanner in = new Scanner(System. final Scanner in = new Scanner(System. final Scanner in = new Scanner(System. final Scanner in = new Scanner(System. final Scanner in = new Scanner(System. final Scanner in = new Scanner(System. final Scanner in = new Scanner(System. final Scanner in = new Scanner(System. final Scanner in = new Scanner(System. final Scanner in = new Scanner(System. final Scanner in = new Scanner(System. final Scanner in = new Scanner(System. final Scanner in = new Scanner(System. final Scanner in = new Scanner(System.in); ); ); System. System. System.out.print("Assassin: 'Choose a number'");.print("Assassin: 'Choose a number'");.print("Assassin: 'Choose a number'");.print("Assassin: 'Choose a number'");.print("Assassin: 'Choose a number'");.print("Assassin: 'Choose a number'");.print("Assassin: 'Choose a number'");.print("Assassin: 'Choose a number'"); number = in.nextDouble(); = in.nextDouble(); = in.nextDouble(); = in.nextDouble(); = in.nextDouble(); = in.nextDouble(); = in.nextDouble(); = in.nextDouble(); = in.nextDouble(); squareRootM. squareRootM. squareRootM.calculateSquare(number););

} }

}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/squareRootM.java

1.1 of 1 2014.12.03 14:55:54

Page 71: Text adventure

1234567891011121314151617181920212223242526272829303132333435

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class stringLength { {

public static void public static void public static void public static void public static void public static void public static void stringLengthKing() { () { () { () { () { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in); // in because patterns ); // in because patterns ); // in because patterns ); // in because patterns ); // in because patterns String enter; String enter; String enter; String enter; String enter; int lengths; int lengths; int lengths; int lengths; int lengths;

System. System. System.out.println("which word do you want to say?");.println("which word do you want to say?");.println("which word do you want to say?");.println("which word do you want to say?");.println("which word do you want to say?");.println("which word do you want to say?");.println("which word do you want to say?");.println("which word do you want to say?"); enter = in.nextLine(); enter = in.nextLine(); enter = in.nextLine(); enter = in.nextLine(); enter = in.nextLine(); enter = in.nextLine(); enter = in.nextLine(); enter = in.nextLine(); enter = in.nextLine(); enter = in.nextLine(); enter = in.nextLine(); lengths = enter.length(); lengths = enter.length(); lengths = enter.length(); lengths = enter.length(); lengths = enter.length(); lengths = enter.length(); lengths = enter.length(); lengths = enter.length(); lengths = enter.length(); lengths = enter.length(); lengths = enter.length(); System. System. System.out.println("Daryl: 'hm, that's about" + lengths + " long.'");.println("Daryl: 'hm, that's about" + lengths + " long.'");.println("Daryl: 'hm, that's about" + lengths + " long.'");.println("Daryl: 'hm, that's about" + lengths + " long.'");.println("Daryl: 'hm, that's about" + lengths + " long.'");.println("Daryl: 'hm, that's about" + lengths + " long.'");.println("Daryl: 'hm, that's about" + lengths + " long.'");.println("Daryl: 'hm, that's about" + lengths + " long.'");.println("Daryl: 'hm, that's about" + lengths + " long.'");.println("Daryl: 'hm, that's about" + lengths + " long.'");.println("Daryl: 'hm, that's about" + lengths + " long.'");.println("Daryl: 'hm, that's about" + lengths + " long.'");.println("Daryl: 'hm, that's about" + lengths + " long.'");.println("Daryl: 'hm, that's about" + lengths + " long.'");.println("Daryl: 'hm, that's about" + lengths + " long.'");.println("Daryl: 'hm, that's about" + lengths + " long.'");.println("Daryl: 'hm, that's about" + lengths + " long.'");.println("Daryl: 'hm, that's about" + lengths + " long.'");

} }

}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/stringLength.java

1.1 of 1 2014.12.03 14:07:44

Page 72: Text adventure

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class strings { {

public static void public static void public static void public static void public static void public static void public static void stringsKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in); ); ); int scan, stringchoice = 0; int scan, stringchoice = 0; int scan, stringchoice = 0; int scan, stringchoice = 0; int scan, stringchoice = 0; int scan, stringchoice = 0; int scan, stringchoice = 0; int scan, stringchoice = 0; int scan, stringchoice = 0; int scan, stringchoice = 0; int scan, stringchoice = 0; int scan, stringchoice = 0; System. System. System.out.println("Lady: 'Oh, yes hello. Welcome to this here humb".println("Lady: 'Oh, yes hello. Welcome to this here humb".println("Lady: 'Oh, yes hello. Welcome to this here humb".println("Lady: 'Oh, yes hello. Welcome to this here humb".println("Lady: 'Oh, yes hello. Welcome to this here humb".println("Lady: 'Oh, yes hello. Welcome to this here humb" + "le farm. Would you be interested in some work pumpkin?"); + "le farm. Would you be interested in some work pumpkin?"); + "le farm. Would you be interested in some work pumpkin?"); + "le farm. Would you be interested in some work pumpkin?"); + "le farm. Would you be interested in some work pumpkin?"); + "le farm. Would you be interested in some work pumpkin?"); + "le farm. Would you be interested in some work pumpkin?"); + "le farm. Would you be interested in some work pumpkin?"); System. System. System.out.println("Lady: 'okay well, daryl needs help with measuri".println("Lady: 'okay well, daryl needs help with measuri".println("Lady: 'okay well, daryl needs help with measuri".println("Lady: 'okay well, daryl needs help with measuri".println("Lady: 'okay well, daryl needs help with measuri".println("Lady: 'okay well, daryl needs help with measuri" + "ng how long of a shot he needs to take.'"); + "ng how long of a shot he needs to take.'"); + "ng how long of a shot he needs to take.'"); + "ng how long of a shot he needs to take.'"); + "ng how long of a shot he needs to take.'"); + "ng how long of a shot he needs to take.'"); + "ng how long of a shot he needs to take.'"); + "ng how long of a shot he needs to take.'"); System. System. System.out.println("Lady: 'Rick needs help learning how to yell.'");.println("Lady: 'Rick needs help learning how to yell.'");.println("Lady: 'Rick needs help learning how to yell.'");.println("Lady: 'Rick needs help learning how to yell.'");.println("Lady: 'Rick needs help learning how to yell.'");.println("Lady: 'Rick needs help learning how to yell.'");.println("Lady: 'Rick needs help learning how to yell.'");.println("Lady: 'Rick needs help learning how to yell.'"); System. System. System.out.println("Lady: 'and carl needs help in the classroom.");.println("Lady: 'and carl needs help in the classroom.");.println("Lady: 'and carl needs help in the classroom.");.println("Lady: 'and carl needs help in the classroom.");.println("Lady: 'and carl needs help in the classroom.");.println("Lady: 'and carl needs help in the classroom.");.println("Lady: 'and carl needs help in the classroom.");.println("Lady: 'and carl needs help in the classroom."); while (stringchoice != 4) { while (stringchoice != 4) { while (stringchoice != 4) { while (stringchoice != 4) { while (stringchoice != 4) { while (stringchoice != 4) { while (stringchoice != 4) { while (stringchoice != 4) { while (stringchoice != 4) { while (stringchoice != 4) { while (stringchoice != 4) { while (stringchoice != 4) { scan = 0; // reset scan at beginning of loop scan = 0; // reset scan at beginning of loop scan = 0; // reset scan at beginning of loop scan = 0; // reset scan at beginning of loop scan = 0; // reset scan at beginning of loop scan = 0; // reset scan at beginning of loop scan = 0; // reset scan at beginning of loop scan = 0; // reset scan at beginning of loop scan = 0; // reset scan at beginning of loop scan = 0; // reset scan at beginning of loop System. System. System.out.println("Choose 1: measuring length, 2: yelling, 3: clas".println("Choose 1: measuring length, 2: yelling, 3: clas".println("Choose 1: measuring length, 2: yelling, 3: clas".println("Choose 1: measuring length, 2: yelling, 3: clas".println("Choose 1: measuring length, 2: yelling, 3: clas".println("Choose 1: measuring length, 2: yelling, 3: clas" + "sroom, or 4: leave"); + "sroom, or 4: leave"); + "sroom, or 4: leave"); + "sroom, or 4: leave"); + "sroom, or 4: leave"); + "sroom, or 4: leave"); + "sroom, or 4: leave"); + "sroom, or 4: leave"); stringchoice = in.nextInt(); stringchoice = in.nextInt(); stringchoice = in.nextInt(); stringchoice = in.nextInt(); stringchoice = in.nextInt(); stringchoice = in.nextInt(); stringchoice = in.nextInt(); stringchoice = in.nextInt(); stringchoice = in.nextInt(); stringchoice = in.nextInt(); stringchoice = in.nextInt(); switch (stringchoice) { switch (stringchoice) { switch (stringchoice) { switch (stringchoice) { switch (stringchoice) { switch (stringchoice) { switch (stringchoice) { switch (stringchoice) { case 1: case 1: case 1: case 1: case 1: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { System. System. System.out.println("You walk up and see Daryl lying".println("You walk up and see Daryl lying".println("You walk up and see Daryl lying".println("You walk up and see Daryl lying".println("You walk up and see Daryl lying".println("You walk up and see Daryl lying" + " ontop of a truck with his sniper."); + " ontop of a truck with his sniper."); + " ontop of a truck with his sniper."); + " ontop of a truck with his sniper."); + " ontop of a truck with his sniper."); + " ontop of a truck with his sniper."); + " ontop of a truck with his sniper."); + " ontop of a truck with his sniper."); System. System. System.out.println("Daryl: 'hey there kid, carol se".println("Daryl: 'hey there kid, carol se".println("Daryl: 'hey there kid, carol se".println("Daryl: 'hey there kid, carol se".println("Daryl: 'hey there kid, carol se".println("Daryl: 'hey there kid, carol se" + "nt you here to help me right?'"); + "nt you here to help me right?'"); + "nt you here to help me right?'"); + "nt you here to help me right?'"); + "nt you here to help me right?'"); + "nt you here to help me right?'"); + "nt you here to help me right?'"); + "nt you here to help me right?'"); System. System. System.out.println("Daryl: 'just say something and ".println("Daryl: 'just say something and ".println("Daryl: 'just say something and ".println("Daryl: 'just say something and ".println("Daryl: 'just say something and ".println("Daryl: 'just say something and " + "I'll work out how long the word is, soun" + "I'll work out how long the word is, soun" + "I'll work out how long the word is, soun" + "I'll work out how long the word is, soun" + "I'll work out how long the word is, soun" + "I'll work out how long the word is, soun" + "ds weird but it helps me'"); + "ds weird but it helps me'"); + "ds weird but it helps me'"); + "ds weird but it helps me'"); + "ds weird but it helps me'"); + "ds weird but it helps me'"); + "ds weird but it helps me'"); + "ds weird but it helps me'"); stringLength. stringLength. stringLength.stringLengthKing();();(); System. System. System.out.println("Daryl: 'thanks kid, move along.".println("Daryl: 'thanks kid, move along.".println("Daryl: 'thanks kid, move along.".println("Daryl: 'thanks kid, move along.".println("Daryl: 'thanks kid, move along.".println("Daryl: 'thanks kid, move along." + "'"); + "'"); + "'"); + "'"); + "'"); + "'"); + "'"); + "'"); System. System. System.out.println("You leave.");.println("You leave.");.println("You leave.");.println("You leave.");.println("You leave.");.println("You leave.");.println("You leave.");.println("You leave."); scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a string");.println("Please enter a string");.println("Please enter a string");.println("Please enter a string");.println("Please enter a string");.println("Please enter a string");.println("Please enter a string");.println("Please enter a string"); } } } } break; break; break; case 2: case 2: case 2: case 2: case 2: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { System. System. System.out.println("You walk up and see rick runnin".println("You walk up and see rick runnin".println("You walk up and see rick runnin".println("You walk up and see rick runnin".println("You walk up and see rick runnin".println("You walk up and see rick runnin" + "g around frantically."); + "g around frantically."); + "g around frantically."); + "g around frantically."); + "g around frantically."); + "g around frantically."); + "g around frantically."); + "g around frantically."); System. System. System.out.println("Rick: 'have you seen Carl? I ca".println("Rick: 'have you seen Carl? I ca".println("Rick: 'have you seen Carl? I ca".println("Rick: 'have you seen Carl? I ca".println("Rick: 'have you seen Carl? I ca".println("Rick: 'have you seen Carl? I ca" + "n't find him anywhere!'"); + "n't find him anywhere!'"); + "n't find him anywhere!'"); + "n't find him anywhere!'"); + "n't find him anywhere!'"); + "n't find him anywhere!'"); + "n't find him anywhere!'"); + "n't find him anywhere!'"); System. System. System.out.println("Rick: 'carl?'");.println("Rick: 'carl?'");.println("Rick: 'carl?'");.println("Rick: 'carl?'");.println("Rick: 'carl?'");.println("Rick: 'carl?'");.println("Rick: 'carl?'");.println("Rick: 'carl?'"); System. System. System.out.println("Rick: 'I've been having some tr".println("Rick: 'I've been having some tr".println("Rick: 'I've been having some tr".println("Rick: 'I've been having some tr".println("Rick: 'I've been having some tr".println("Rick: 'I've been having some tr" + "ouble yelling lately, could you help?'"); + "ouble yelling lately, could you help?'"); + "ouble yelling lately, could you help?'"); + "ouble yelling lately, could you help?'"); + "ouble yelling lately, could you help?'"); + "ouble yelling lately, could you help?'"); + "ouble yelling lately, could you help?'"); + "ouble yelling lately, could you help?'"); System. System. System.out.println("Rick: 'Tell me something to yel".println("Rick: 'Tell me something to yel".println("Rick: 'Tell me something to yel".println("Rick: 'Tell me something to yel".println("Rick: 'Tell me something to yel".println("Rick: 'Tell me something to yel" + "l.'"); + "l.'"); + "l.'"); + "l.'"); + "l.'"); + "l.'"); + "l.'"); + "l.'"); toUpperCase. toUpperCase. toUpperCase.toUpperCaseKing();();(); System. System. System.out.println("Rick: 'I still can't find him, ".println("Rick: 'I still can't find him, ".println("Rick: 'I still can't find him, ".println("Rick: 'I still can't find him, ".println("Rick: 'I still can't find him, ".println("Rick: 'I still can't find him, " + "but thanks anyway.'"); + "but thanks anyway.'"); + "but thanks anyway.'"); + "but thanks anyway.'"); + "but thanks anyway.'"); + "but thanks anyway.'"); + "but thanks anyway.'"); + "but thanks anyway.'"); System. System. System.out.println("You leave, confused.");.println("You leave, confused.");.println("You leave, confused.");.println("You leave, confused.");.println("You leave, confused.");.println("You leave, confused.");.println("You leave, confused.");.println("You leave, confused."); scan++; //kills loop scan++; //kills loop scan++; //kills loop scan++; //kills loop scan++; //kills loop scan++; //kills loop } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a string");.println("Please enter a string");.println("Please enter a string");.println("Please enter a string");.println("Please enter a string");.println("Please enter a string");.println("Please enter a string");.println("Please enter a string"); } } } }

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/strings.java

1.1 of 2 2014.12.03 14:22:27

Page 73: Text adventure

737475767778798081828384858687888990919293949596979899100101102103104105

} } break; break; break; case 3: case 3: case 3: case 3: case 3: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { System. System. System.out.println("You walk up to a school house a".println("You walk up to a school house a".println("You walk up to a school house a".println("You walk up to a school house a".println("You walk up to a school house a".println("You walk up to a school house a" + "nd see a young man standing infront of a" + "nd see a young man standing infront of a" + "nd see a young man standing infront of a" + "nd see a young man standing infront of a" + "nd see a young man standing infront of a" + "nd see a young man standing infront of a" + " chalk board and the name 'carl' written" + " chalk board and the name 'carl' written" + " chalk board and the name 'carl' written" + " chalk board and the name 'carl' written" + " chalk board and the name 'carl' written" + " chalk board and the name 'carl' written" + " behind him."); + " behind him."); + " behind him."); + " behind him."); + " behind him."); + " behind him."); + " behind him."); + " behind him."); System. System. System.out.println("Carl: 'Oh hey there, I'm teachi".println("Carl: 'Oh hey there, I'm teachi".println("Carl: 'Oh hey there, I'm teachi".println("Carl: 'Oh hey there, I'm teachi".println("Carl: 'Oh hey there, I'm teachi".println("Carl: 'Oh hey there, I'm teachi" + "ng these kids about palendromes today, c" + "ng these kids about palendromes today, c" + "ng these kids about palendromes today, c" + "ng these kids about palendromes today, c" + "ng these kids about palendromes today, c" + "ng these kids about palendromes today, c" + "an you help us out."); + "an you help us out."); + "an you help us out."); + "an you help us out."); + "an you help us out."); + "an you help us out."); + "an you help us out."); + "an you help us out."); System. System. System.out.println("You nod");.println("You nod");.println("You nod");.println("You nod");.println("You nod");.println("You nod");.println("You nod");.println("You nod"); System. System. System.out.println("Give us a word and we'll see if".println("Give us a word and we'll see if".println("Give us a word and we'll see if".println("Give us a word and we'll see if".println("Give us a word and we'll see if".println("Give us a word and we'll see if" + " it's a palendrome or not."); + " it's a palendrome or not."); + " it's a palendrome or not."); + " it's a palendrome or not."); + " it's a palendrome or not."); + " it's a palendrome or not."); + " it's a palendrome or not."); + " it's a palendrome or not."); palendromeCheck. palendromeCheck. palendromeCheck.palendromeCheckKing();();(); System. System. System.out.println("Carl: 'Good job, thanks for you".println("Carl: 'Good job, thanks for you".println("Carl: 'Good job, thanks for you".println("Carl: 'Good job, thanks for you".println("Carl: 'Good job, thanks for you".println("Carl: 'Good job, thanks for you" + "r help.'"); + "r help.'"); + "r help.'"); + "r help.'"); + "r help.'"); + "r help.'"); + "r help.'"); + "r help.'"); System. System. System.out.println("You leave, it's weird, carl is ".println("You leave, it's weird, carl is ".println("You leave, it's weird, carl is ".println("You leave, it's weird, carl is ".println("You leave, it's weird, carl is ".println("You leave, it's weird, carl is " + "actually in the house this time."); + "actually in the house this time."); + "actually in the house this time."); + "actually in the house this time."); + "actually in the house this time."); + "actually in the house this time."); + "actually in the house this time."); + "actually in the house this time."); scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a string");.println("Please enter a string");.println("Please enter a string");.println("Please enter a string");.println("Please enter a string");.println("Please enter a string");.println("Please enter a string");.println("Please enter a string"); } } } } break; break; break; } }

} } } }

}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/strings.java

2.1 of 2 2014.12.03 14:22:27

Page 74: Text adventure

123456789101112131415161718192021222324252627282930313233343536373839

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class tOrF { {

public static void public static void public static void public static void public static void public static void public static void tOrFKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in);); System. System. System.out.println("Architecht: 'What is 12+12?'");.println("Architecht: 'What is 12+12?'");.println("Architecht: 'What is 12+12?'");.println("Architecht: 'What is 12+12?'");.println("Architecht: 'What is 12+12?'");.println("Architecht: 'What is 12+12?'");.println("Architecht: 'What is 12+12?'");.println("Architecht: 'What is 12+12?'"); int answer; int answer; int answer; int answer; int answer; answer = in.nextInt(); answer = in.nextInt(); answer = in.nextInt(); answer = in.nextInt(); answer = in.nextInt(); answer = in.nextInt(); answer = in.nextInt(); answer = in.nextInt(); answer = in.nextInt(); answer = in.nextInt(); answer = in.nextInt(); System. System. System.out.print(answer == 24 ? "True" : "False"); //compressed if.print(answer == 24 ? "True" : "False"); //compressed if.print(answer == 24 ? "True" : "False"); //compressed if.print(answer == 24 ? "True" : "False"); //compressed if.print(answer == 24 ? "True" : "False"); //compressed if.print(answer == 24 ? "True" : "False"); //compressed if.print(answer == 24 ? "True" : "False"); //compressed if.print(answer == 24 ? "True" : "False"); //compressed if.print(answer == 24 ? "True" : "False"); //compressed if.print(answer == 24 ? "True" : "False"); //compressed if.print(answer == 24 ? "True" : "False"); //compressed if.print(answer == 24 ? "True" : "False"); //compressed if.print(answer == 24 ? "True" : "False"); //compressed if.print(answer == 24 ? "True" : "False"); //compressed if.print(answer == 24 ? "True" : "False"); //compressed if.print(answer == 24 ? "True" : "False"); //compressed if.print(answer == 24 ? "True" : "False"); //compressed if.print(answer == 24 ? "True" : "False"); //compressed if.print(answer == 24 ? "True" : "False"); //compressed if.print(answer == 24 ? "True" : "False"); //compressed if.print(answer == 24 ? "True" : "False"); //compressed if.print(answer == 24 ? "True" : "False"); //compressed if.print(answer == 24 ? "True" : "False"); //compressed if.print(answer == 24 ? "True" : "False"); //compressed if if (answer == 24) { if (answer == 24) { if (answer == 24) { if (answer == 24) { if (answer == 24) { if (answer == 24) { if (answer == 24) { if (answer == 24) { if (answer == 24) { if (answer == 24) { if (answer == 24) { if (answer == 24) { System. System. System.out.println("Architect: 'Good job, you may stay'");.println("Architect: 'Good job, you may stay'");.println("Architect: 'Good job, you may stay'");.println("Architect: 'Good job, you may stay'");.println("Architect: 'Good job, you may stay'");.println("Architect: 'Good job, you may stay'");.println("Architect: 'Good job, you may stay'");.println("Architect: 'Good job, you may stay'"); System. System. System.out.println("The door behind you slowly opens, you leave");.println("The door behind you slowly opens, you leave");.println("The door behind you slowly opens, you leave");.println("The door behind you slowly opens, you leave");.println("The door behind you slowly opens, you leave");.println("The door behind you slowly opens, you leave");.println("The door behind you slowly opens, you leave");.println("The door behind you slowly opens, you leave"); } else { // you did math incorrectly, death scenario } else { // you did math incorrectly, death scenario } else { // you did math incorrectly, death scenario } else { // you did math incorrectly, death scenario } else { // you did math incorrectly, death scenario } else { // you did math incorrectly, death scenario } else { // you did math incorrectly, death scenario } else { // you did math incorrectly, death scenario System. System. System.out.println("Architect: 'You chose, poorly.'");.println("Architect: 'You chose, poorly.'");.println("Architect: 'You chose, poorly.'");.println("Architect: 'You chose, poorly.'");.println("Architect: 'You chose, poorly.'");.println("Architect: 'You chose, poorly.'");.println("Architect: 'You chose, poorly.'");.println("Architect: 'You chose, poorly.'"); System. System. System.out.println("The Architect dissapears and the room starts ".println("The Architect dissapears and the room starts ".println("The Architect dissapears and the room starts ".println("The Architect dissapears and the room starts ".println("The Architect dissapears and the room starts ".println("The Architect dissapears and the room starts " + "filling with darkness."); + "filling with darkness."); + "filling with darkness."); + "filling with darkness."); + "filling with darkness."); + "filling with darkness."); + "filling with darkness."); + "filling with darkness."); System. System. System.out.println("You hear voices speak in the dark");.println("You hear voices speak in the dark");.println("You hear voices speak in the dark");.println("You hear voices speak in the dark");.println("You hear voices speak in the dark");.println("You hear voices speak in the dark");.println("You hear voices speak in the dark");.println("You hear voices speak in the dark"); System. System. System.out.println("Voices: 'We are so hungry'");.println("Voices: 'We are so hungry'");.println("Voices: 'We are so hungry'");.println("Voices: 'We are so hungry'");.println("Voices: 'We are so hungry'");.println("Voices: 'We are so hungry'");.println("Voices: 'We are so hungry'");.println("Voices: 'We are so hungry'"); System. System. System.out.println("The last bit of light turns to darkness and ".println("The last bit of light turns to darkness and ".println("The last bit of light turns to darkness and ".println("The last bit of light turns to darkness and ".println("The last bit of light turns to darkness and ".println("The last bit of light turns to darkness and " + "you are eaten alive by the voices."); + "you are eaten alive by the voices."); + "you are eaten alive by the voices."); + "you are eaten alive by the voices."); + "you are eaten alive by the voices."); + "you are eaten alive by the voices."); + "you are eaten alive by the voices."); + "you are eaten alive by the voices."); System. System. System.out.println("You died, try again.");.println("You died, try again.");.println("You died, try again.");.println("You died, try again.");.println("You died, try again.");.println("You died, try again.");.println("You died, try again.");.println("You died, try again."); } } } }}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/tOrF.java

1.1 of 1 2014.12.03 15:06:21

Page 75: Text adventure

12345678910111213141516171819202122232425262728

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class toUpperCase { {

public static void public static void public static void public static void public static void public static void public static void toUpperCaseKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in);); System. System. System.out.print("What do you tell him?");.print("What do you tell him?");.print("What do you tell him?");.print("What do you tell him?");.print("What do you tell him?");.print("What do you tell him?");.print("What do you tell him?");.print("What do you tell him?"); // capitalizes the input // capitalizes the input String line = in.nextLine().toUpperCase(); String line = in.nextLine().toUpperCase(); String line = in.nextLine().toUpperCase(); String line = in.nextLine().toUpperCase(); String line = in.nextLine().toUpperCase(); String line = in.nextLine().toUpperCase(); String line = in.nextLine().toUpperCase(); String line = in.nextLine().toUpperCase(); String line = in.nextLine().toUpperCase(); String line = in.nextLine().toUpperCase(); String line = in.nextLine().toUpperCase(); String line = in.nextLine().toUpperCase(); String line = in.nextLine().toUpperCase(); String line = in.nextLine().toUpperCase(); String line = in.nextLine().toUpperCase(); String line = in.nextLine().toUpperCase(); String line = in.nextLine().toUpperCase(); System. System. System.out.println("Rick: '" + line);.println("Rick: '" + line);.println("Rick: '" + line);.println("Rick: '" + line);.println("Rick: '" + line);.println("Rick: '" + line);.println("Rick: '" + line);.println("Rick: '" + line);.println("Rick: '" + line);.println("Rick: '" + line);.println("Rick: '" + line);.println("Rick: '" + line);

} }

}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/toUpperCase.java

1.1 of 1 2014.12.03 14:07:27

Page 76: Text adventure

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class tryNCatch { {

public static void public static void public static void public static void public static void public static void public static void tryNCatchKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in); ); ); int StPigeonations = 0; // 100 points if you get the reference int StPigeonations = 0; // 100 points if you get the reference int StPigeonations = 0; // 100 points if you get the reference int StPigeonations = 0; // 100 points if you get the reference int StPigeonations = 0; // 100 points if you get the reference int StPigeonations = 0; // 100 points if you get the reference int StPigeonations = 0; // 100 points if you get the reference int StPigeonations = 0; // 100 points if you get the reference int StPigeonations = 0; // 100 points if you get the reference int StPigeonations = 0; // 100 points if you get the reference int StPigeonations = 0; // 100 points if you get the reference int scan; int scan; int scan; int scan; int scan; System. System. System.out.println("You enter the library and find a man sitting at a ".println("You enter the library and find a man sitting at a ".println("You enter the library and find a man sitting at a ".println("You enter the library and find a man sitting at a ".println("You enter the library and find a man sitting at a ".println("You enter the library and find a man sitting at a " + "desk"); + "desk"); + "desk"); + "desk"); + "desk"); + "desk"); + "desk"); + "desk"); System. System. System.out.println("Man: 'Yes hello, welcome to the library we are ".println("Man: 'Yes hello, welcome to the library we are ".println("Man: 'Yes hello, welcome to the library we are ".println("Man: 'Yes hello, welcome to the library we are ".println("Man: 'Yes hello, welcome to the library we are ".println("Man: 'Yes hello, welcome to the library we are " + "undergoing renovations, only two rooms are available."); + "undergoing renovations, only two rooms are available."); + "undergoing renovations, only two rooms are available."); + "undergoing renovations, only two rooms are available."); + "undergoing renovations, only two rooms are available."); + "undergoing renovations, only two rooms are available."); + "undergoing renovations, only two rooms are available."); + "undergoing renovations, only two rooms are available."); while (StPigeonations != 4) { while (StPigeonations != 4) { while (StPigeonations != 4) { while (StPigeonations != 4) { while (StPigeonations != 4) { while (StPigeonations != 4) { while (StPigeonations != 4) { while (StPigeonations != 4) { while (StPigeonations != 4) { while (StPigeonations != 4) { while (StPigeonations != 4) { while (StPigeonations != 4) { scan = 0; scan = 0; scan = 0; scan = 0; scan = 0; scan = 0; scan = 0; System. System. System.out.println("Do you want to enter the 1:Id card office, ".println("Do you want to enter the 1:Id card office, ".println("Do you want to enter the 1:Id card office, ".println("Do you want to enter the 1:Id card office, ".println("Do you want to enter the 1:Id card office, ".println("Do you want to enter the 1:Id card office, " + "2:The height converter 3:go into a closed off room or " + "2:The height converter 3:go into a closed off room or " + "2:The height converter 3:go into a closed off room or " + "2:The height converter 3:go into a closed off room or " + "2:The height converter 3:go into a closed off room or " + "2:The height converter 3:go into a closed off room or " + "4:leave"); + "4:leave"); + "4:leave"); + "4:leave"); + "4:leave"); + "4:leave"); + "4:leave"); + "4:leave"); StPigeonations = in.nextInt(); StPigeonations = in.nextInt(); StPigeonations = in.nextInt(); StPigeonations = in.nextInt(); StPigeonations = in.nextInt(); StPigeonations = in.nextInt(); StPigeonations = in.nextInt(); StPigeonations = in.nextInt(); StPigeonations = in.nextInt(); StPigeonations = in.nextInt(); StPigeonations = in.nextInt(); switch (StPigeonations) { switch (StPigeonations) { switch (StPigeonations) { switch (StPigeonations) { switch (StPigeonations) { switch (StPigeonations) { switch (StPigeonations) { switch (StPigeonations) { case 1: case 1: case 1: case 1: case 1: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { System. System. System.out.println("You enter the Id card issuer an".println("You enter the Id card issuer an".println("You enter the Id card issuer an".println("You enter the Id card issuer an".println("You enter the Id card issuer an".println("You enter the Id card issuer an" + "d a librarian looks up at you."); + "d a librarian looks up at you."); + "d a librarian looks up at you."); + "d a librarian looks up at you."); + "d a librarian looks up at you."); + "d a librarian looks up at you."); + "d a librarian looks up at you."); + "d a librarian looks up at you."); System. System. System.out.println("Librarian: 'Oh god another one,".println("Librarian: 'Oh god another one,".println("Librarian: 'Oh god another one,".println("Librarian: 'Oh god another one,".println("Librarian: 'Oh god another one,".println("Librarian: 'Oh god another one," + " okay come along I need some information" + " okay come along I need some information" + " okay come along I need some information" + " okay come along I need some information" + " okay come along I need some information" + " okay come along I need some information" + " from you."); + " from you."); + " from you."); + " from you."); + " from you."); + " from you."); + " from you."); + " from you."); System. System. System.out.println("Librarian: 'First, what is you ".println("Librarian: 'First, what is you ".println("Librarian: 'First, what is you ".println("Librarian: 'First, what is you ".println("Librarian: 'First, what is you ".println("Librarian: 'First, what is you " + "Id number?'"); + "Id number?'"); + "Id number?'"); + "Id number?'"); + "Id number?'"); + "Id number?'"); + "Id number?'"); + "Id number?'"); System. System. System.out.println("As you have not been issued one".println("As you have not been issued one".println("As you have not been issued one".println("As you have not been issued one".println("As you have not been issued one".println("As you have not been issued one" + " you look confused"); + " you look confused"); + " you look confused"); + " you look confused"); + " you look confused"); + " you look confused"); + " you look confused"); + " you look confused"); System. System. System.out.println("Librarian: 'Come along, the Id ".println("Librarian: 'Come along, the Id ".println("Librarian: 'Come along, the Id ".println("Librarian: 'Come along, the Id ".println("Librarian: 'Come along, the Id ".println("Librarian: 'Come along, the Id " + "number, it's 10 or less numbers long."); + "number, it's 10 or less numbers long."); + "number, it's 10 or less numbers long."); + "number, it's 10 or less numbers long."); + "number, it's 10 or less numbers long."); + "number, it's 10 or less numbers long."); + "number, it's 10 or less numbers long."); + "number, it's 10 or less numbers long."); System. System. System.out.println("You stare blankly and start to ".println("You stare blankly and start to ".println("You stare blankly and start to ".println("You stare blankly and start to ".println("You stare blankly and start to ".println("You stare blankly and start to " + "make up an Id number to give her hoping " + "make up an Id number to give her hoping " + "make up an Id number to give her hoping " + "make up an Id number to give her hoping " + "make up an Id number to give her hoping " + "make up an Id number to give her hoping " + "it's real."); + "it's real."); + "it's real."); + "it's real."); + "it's real."); + "it's real."); + "it's real."); + "it's real."); idNumber. idNumber. idNumber.idNumberKing();();(); System. System. System.out.println("You walk out of the building.");.println("You walk out of the building.");.println("You walk out of the building.");.println("You walk out of the building.");.println("You walk out of the building.");.println("You walk out of the building.");.println("You walk out of the building.");.println("You walk out of the building."); scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number"); } } } } break; break; break;

case 2: case 2: case 2: case 2: case 2: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { System. System. System.out.println("You enter a room and see a very".println("You enter a room and see a very".println("You enter a room and see a very".println("You enter a room and see a very".println("You enter a room and see a very".println("You enter a room and see a very" + " official looking man"); + " official looking man"); + " official looking man"); + " official looking man"); + " official looking man"); + " official looking man"); + " official looking man"); + " official looking man"); fToCm. fToCm. fToCm.fToCmKing();();(); System. System. System.out.println("Official: 'Thank you sir, you m".println("Official: 'Thank you sir, you m".println("Official: 'Thank you sir, you m".println("Official: 'Thank you sir, you m".println("Official: 'Thank you sir, you m".println("Official: 'Thank you sir, you m" + "ay go'"); + "ay go'"); + "ay go'"); + "ay go'"); + "ay go'"); + "ay go'"); + "ay go'"); + "ay go'"); scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers");.println("Please enter numbers"); } } } } break; break; break; case 3: case 3: case 3: case 3: case 3:

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/tryNCatch.java

1.1 of 2 2014.12.03 14:49:59

Page 77: Text adventure

737475767778798081828384858687888990919293949596979899100101102103104105106107108109110

case 3: case 3: case 3: case 3: case 3: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { System. System. System.out.println("You sneak past the man and thro".println("You sneak past the man and thro".println("You sneak past the man and thro".println("You sneak past the man and thro".println("You sneak past the man and thro".println("You sneak past the man and thro" + "ugh a door reading 'do not pass'"); + "ugh a door reading 'do not pass'"); + "ugh a door reading 'do not pass'"); + "ugh a door reading 'do not pass'"); + "ugh a door reading 'do not pass'"); + "ugh a door reading 'do not pass'"); + "ugh a door reading 'do not pass'"); + "ugh a door reading 'do not pass'"); System. System. System.out.println("you enter a room and see a youn".println("you enter a room and see a youn".println("you enter a room and see a youn".println("you enter a room and see a youn".println("you enter a room and see a youn".println("you enter a room and see a youn" + "g boy standing quietly in the corner."); + "g boy standing quietly in the corner."); + "g boy standing quietly in the corner."); + "g boy standing quietly in the corner."); + "g boy standing quietly in the corner."); + "g boy standing quietly in the corner."); + "g boy standing quietly in the corner."); + "g boy standing quietly in the corner."); System. System. System.out.println("You say hello, slightly scared");.println("You say hello, slightly scared");.println("You say hello, slightly scared");.println("You say hello, slightly scared");.println("You say hello, slightly scared");.println("You say hello, slightly scared");.println("You say hello, slightly scared");.println("You say hello, slightly scared"); System. System. System.out.println("Boy: !... 'You shouldn't be in ".println("Boy: !... 'You shouldn't be in ".println("Boy: !... 'You shouldn't be in ".println("Boy: !... 'You shouldn't be in ".println("Boy: !... 'You shouldn't be in ".println("Boy: !... 'You shouldn't be in " + "here'"); + "here'"); + "here'"); + "here'"); + "here'"); + "here'"); + "here'"); + "here'"); System. System. System.out.println("You ask him why he's in here");.println("You ask him why he's in here");.println("You ask him why he's in here");.println("You ask him why he's in here");.println("You ask him why he's in here");.println("You ask him why he's in here");.println("You ask him why he's in here");.println("You ask him why he's in here"); System. System. System.out.println("Boy: 'I like it here. It's quie".println("Boy: 'I like it here. It's quie".println("Boy: 'I like it here. It's quie".println("Boy: 'I like it here. It's quie".println("Boy: 'I like it here. It's quie".println("Boy: 'I like it here. It's quie" + "t"); + "t"); + "t"); + "t"); + "t"); + "t"); + "t"); + "t"); System. System. System.out.println("You ask him name");.println("You ask him name");.println("You ask him name");.println("You ask him name");.println("You ask him name");.println("You ask him name");.println("You ask him name");.println("You ask him name"); System. System. System.out.println("Boy: 'Ne.. Negeki'");.println("Boy: 'Ne.. Negeki'");.println("Boy: 'Ne.. Negeki'");.println("Boy: 'Ne.. Negeki'");.println("Boy: 'Ne.. Negeki'");.println("Boy: 'Ne.. Negeki'");.println("Boy: 'Ne.. Negeki'");.println("Boy: 'Ne.. Negeki'"); System. System. System.out.println("You greet him warmly and go to ".println("You greet him warmly and go to ".println("You greet him warmly and go to ".println("You greet him warmly and go to ".println("You greet him warmly and go to ".println("You greet him warmly and go to " + "shake his hand, he backs away quickly"); + "shake his hand, he backs away quickly"); + "shake his hand, he backs away quickly"); + "shake his hand, he backs away quickly"); + "shake his hand, he backs away quickly"); + "shake his hand, he backs away quickly"); + "shake his hand, he backs away quickly"); + "shake his hand, he backs away quickly"); System. System. System.out.println("Negeki: 'You can't touch me... ".println("Negeki: 'You can't touch me... ".println("Negeki: 'You can't touch me... ".println("Negeki: 'You can't touch me... ".println("Negeki: 'You can't touch me... ".println("Negeki: 'You can't touch me... " + "We can play a game though, do you want t" + "We can play a game though, do you want t" + "We can play a game though, do you want t" + "We can play a game though, do you want t" + "We can play a game though, do you want t" + "We can play a game though, do you want t" + "o play?'"); + "o play?'"); + "o play?'"); + "o play?'"); + "o play?'"); + "o play?'"); + "o play?'"); + "o play?'"); System. System. System.out.println("You nod.");.println("You nod.");.println("You nod.");.println("You nod.");.println("You nod.");.println("You nod.");.println("You nod.");.println("You nod."); System. System. System.out.println("Negeki: 'Okay, I'm thinking of ".println("Negeki: 'Okay, I'm thinking of ".println("Negeki: 'Okay, I'm thinking of ".println("Negeki: 'Okay, I'm thinking of ".println("Negeki: 'Okay, I'm thinking of ".println("Negeki: 'Okay, I'm thinking of " + "multiple numbers, you only need to guess" + "multiple numbers, you only need to guess" + "multiple numbers, you only need to guess" + "multiple numbers, you only need to guess" + "multiple numbers, you only need to guess" + "multiple numbers, you only need to guess" + " one of them it's divisable by 2 and one" + " one of them it's divisable by 2 and one" + " one of them it's divisable by 2 and one" + " one of them it's divisable by 2 and one" + " one of them it's divisable by 2 and one" + " one of them it's divisable by 2 and one" + " other number."); + " other number."); + " other number."); + " other number."); + " other number."); + " other number."); + " other number."); + " other number."); chooseANumber. chooseANumber. chooseANumber.chooseANumberKing();();(); scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number"); } } } } break; break; break; } }

} } } }}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/tryNCatch.java

2.1 of 2 2014.12.03 14:49:59

Page 78: Text adventure

123456789101112131415161718192021222324252627282930

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class variableSection { {

public static void public static void public static void public static void public static void public static void public static void variableking() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in);); int scan, building = 0; int scan, building = 0; int scan, building = 0; int scan, building = 0; int scan, building = 0; int scan, building = 0; int scan, building = 0; int scan, building = 0; int scan, building = 0; int scan, building = 0; int scan, building = 0; int scan, building = 0; System. System. System.out.println("You have chosen the land of variable knowldge");.println("You have chosen the land of variable knowldge");.println("You have chosen the land of variable knowldge");.println("You have chosen the land of variable knowldge");.println("You have chosen the land of variable knowldge");.println("You have chosen the land of variable knowldge");.println("You have chosen the land of variable knowldge");.println("You have chosen the land of variable knowldge"); System. System. System.out.println("You enter the town and you see the school house whe".println("You enter the town and you see the school house whe".println("You enter the town and you see the school house whe".println("You enter the town and you see the school house whe".println("You enter the town and you see the school house whe".println("You enter the town and you see the school house whe" + "re the children learn multiplication."); + "re the children learn multiplication."); + "re the children learn multiplication."); + "re the children learn multiplication."); + "re the children learn multiplication."); + "re the children learn multiplication."); + "re the children learn multiplication."); + "re the children learn multiplication."); System. System. System.out.println("You also see the factory where the workers create t".println("You also see the factory where the workers create t".println("You also see the factory where the workers create t".println("You also see the factory where the workers create t".println("You also see the factory where the workers create t".println("You also see the factory where the workers create t" + "hese things called, variables."); + "hese things called, variables."); + "hese things called, variables."); + "hese things called, variables."); + "hese things called, variables."); + "hese things called, variables."); + "hese things called, variables."); + "hese things called, variables."); System. System. System.out.println("Lastly you see the export building, where they sepe".println("Lastly you see the export building, where they sepe".println("Lastly you see the export building, where they sepe".println("Lastly you see the export building, where they sepe".println("Lastly you see the export building, where they sepe".println("Lastly you see the export building, where they sepe" + "rate between even and odd."); + "rate between even and odd."); + "rate between even and odd."); + "rate between even and odd."); + "rate between even and odd."); + "rate between even and odd."); + "rate between even and odd."); + "rate between even and odd."); while (building != 4) { while (building != 4) { while (building != 4) { while (building != 4) { while (building != 4) { while (building != 4) { while (building != 4) { while (building != 4) { while (building != 4) { while (building != 4) { while (building != 4) { while (building != 4) { scan = 0; scan = 0; scan = 0; scan = 0; scan = 0; scan = 0; scan = 0; System. System. System.out.println("Which building would you like to visit? 1: The".println("Which building would you like to visit? 1: The".println("Which building would you like to visit? 1: The".println("Which building would you like to visit? 1: The".println("Which building would you like to visit? 1: The".println("Which building would you like to visit? 1: The" + " school, 2: The factory, 3: Exports or 4: leave?"); + " school, 2: The factory, 3: Exports or 4: leave?"); + " school, 2: The factory, 3: Exports or 4: leave?"); + " school, 2: The factory, 3: Exports or 4: leave?"); + " school, 2: The factory, 3: Exports or 4: leave?"); + " school, 2: The factory, 3: Exports or 4: leave?"); + " school, 2: The factory, 3: Exports or 4: leave?"); + " school, 2: The factory, 3: Exports or 4: leave?"); building = in.nextInt(); building = in.nextInt(); building = in.nextInt(); building = in.nextInt(); building = in.nextInt(); building = in.nextInt(); building = in.nextInt(); building = in.nextInt(); building = in.nextInt(); building = in.nextInt(); building = in.nextInt(); switch (building) { switch (building) { switch (building) { switch (building) { switch (building) { switch (building) { switch (building) { switch (building) { case 1: case 1: case 1: case 1: case 1: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { System. System. System.out.println("The kids ask you to give them 2".println("The kids ask you to give them 2".println("The kids ask you to give them 2".println("The kids ask you to give them 2".println("The kids ask you to give them 2".println("The kids ask you to give them 2" + " numbers to multiply."); + " numbers to multiply."); + " numbers to multiply."); + " numbers to multiply."); + " numbers to multiply."); + " numbers to multiply."); + " numbers to multiply."); + " numbers to multiply."); multiplicationSimple. multiplicationSimple. multiplicationSimple.multiplicationSimpleKing();();(); System. System. System.out.println("The children thank you and you ".println("The children thank you and you ".println("The children thank you and you ".println("The children thank you and you ".println("The children thank you and you ".println("The children thank you and you " + "go about your way."); + "go about your way."); + "go about your way."); + "go about your way."); + "go about your way."); + "go about your way."); + "go about your way."); + "go about your way."); scan++; scan++; scan++; scan++; } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Pleas enter a number!");.println("Pleas enter a number!");.println("Pleas enter a number!");.println("Pleas enter a number!");.println("Pleas enter a number!");.println("Pleas enter a number!");.println("Pleas enter a number!");.println("Pleas enter a number!"); } } } } break; break; break; case 2: case 2: case 2: case 2: case 2: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { System. System. System.out.println("You enter the factory and see ".println("You enter the factory and see ".println("You enter the factory and see ".println("You enter the factory and see ".println("You enter the factory and see ".println("You enter the factory and see " + "the CFO of the factory run up to you"); + "the CFO of the factory run up to you"); + "the CFO of the factory run up to you"); + "the CFO of the factory run up to you"); + "the CFO of the factory run up to you"); + "the CFO of the factory run up to you"); + "the CFO of the factory run up to you"); + "the CFO of the factory run up to you"); System. System. System.out.println("CFO: 'Oh thank god you've arriv".println("CFO: 'Oh thank god you've arriv".println("CFO: 'Oh thank god you've arriv".println("CFO: 'Oh thank god you've arriv".println("CFO: 'Oh thank god you've arriv".println("CFO: 'Oh thank god you've arriv" + "ed, we need you to test the machine!'"); + "ed, we need you to test the machine!'"); + "ed, we need you to test the machine!'"); + "ed, we need you to test the machine!'"); + "ed, we need you to test the machine!'"); + "ed, we need you to test the machine!'"); + "ed, we need you to test the machine!'"); + "ed, we need you to test the machine!'"); System. System. System.out.println("He says and quickly grabs you b".println("He says and quickly grabs you b".println("He says and quickly grabs you b".println("He says and quickly grabs you b".println("He says and quickly grabs you b".println("He says and quickly grabs you b" + "uy the hand and drags you to the machin" + "uy the hand and drags you to the machin" + "uy the hand and drags you to the machin" + "uy the hand and drags you to the machin" + "uy the hand and drags you to the machin" + "uy the hand and drags you to the machin" + "e"); + "e"); + "e"); + "e"); + "e"); + "e"); + "e"); + "e"); System. System. System.out.println("CFO: 'just follow the instructi".println("CFO: 'just follow the instructi".println("CFO: 'just follow the instructi".println("CFO: 'just follow the instructi".println("CFO: 'just follow the instructi".println("CFO: 'just follow the instructi" + "ons on the screen'"); + "ons on the screen'"); + "ons on the screen'"); + "ons on the screen'"); + "ons on the screen'"); + "ons on the screen'"); + "ons on the screen'"); + "ons on the screen'"); declareVariable. declareVariable. declareVariable.declareVariableKing();();(); System. System. System.out.println("CFO: 'Oh it's working, wonderfu".println("CFO: 'Oh it's working, wonderfu".println("CFO: 'Oh it's working, wonderfu".println("CFO: 'Oh it's working, wonderfu".println("CFO: 'Oh it's working, wonderfu".println("CFO: 'Oh it's working, wonderfu" + "l. Thank you for your time."); + "l. Thank you for your time."); + "l. Thank you for your time."); + "l. Thank you for your time."); + "l. Thank you for your time."); + "l. Thank you for your time."); + "l. Thank you for your time."); + "l. Thank you for your time."); System. System. System.out.println("They escort you out of the fact".println("They escort you out of the fact".println("They escort you out of the fact".println("They escort you out of the fact".println("They escort you out of the fact".println("They escort you out of the fact" + "ory and you go about your way."); + "ory and you go about your way."); + "ory and you go about your way."); + "ory and you go about your way."); + "ory and you go about your way."); + "ory and you go about your way."); + "ory and you go about your way."); + "ory and you go about your way."); scan++; scan++; scan++; scan++; } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Pleas enter a number!");.println("Pleas enter a number!");.println("Pleas enter a number!");.println("Pleas enter a number!");.println("Pleas enter a number!");.println("Pleas enter a number!");.println("Pleas enter a number!");.println("Pleas enter a number!"); } } } } break; break; break; case 3: case 3: case 3: case 3: case 3: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try {

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/variableSection.java

1.1 of 2 2014.12.03 13:26:55

Page 79: Text adventure

30

try { try { try { try { System. System. System.out.println("You enter the export factory, m".println("You enter the export factory, m".println("You enter the export factory, m".println("You enter the export factory, m".println("You enter the export factory, m".println("You enter the export factory, m" + "istaken for a worker, and immediately pu" + "istaken for a worker, and immediately pu" + "istaken for a worker, and immediately pu" + "istaken for a worker, and immediately pu" + "istaken for a worker, and immediately pu" + "istaken for a worker, and immediately pu" + "t to work."); + "t to work."); + "t to work."); + "t to work."); + "t to work."); + "t to work."); + "t to work."); + "t to work."); System. System. System.out.println("Worker: 'Just enter numbers and".println("Worker: 'Just enter numbers and".println("Worker: 'Just enter numbers and".println("Worker: 'Just enter numbers and".println("Worker: 'Just enter numbers and".println("Worker: 'Just enter numbers and" + " the machine spits out an answer'"); + " the machine spits out an answer'"); + " the machine spits out an answer'"); + " the machine spits out an answer'"); + " the machine spits out an answer'"); + " the machine spits out an answer'"); + " the machine spits out an answer'"); + " the machine spits out an answer'"); evenOrOdd. evenOrOdd. evenOrOdd.evenOrOddKing();();(); System. System. System.out.println("Worker: 'Good job, but we're ov".println("Worker: 'Good job, but we're ov".println("Worker: 'Good job, but we're ov".println("Worker: 'Good job, but we're ov".println("Worker: 'Good job, but we're ov".println("Worker: 'Good job, but we're ov" + "erstaffed, get out.'"); + "erstaffed, get out.'"); + "erstaffed, get out.'"); + "erstaffed, get out.'"); + "erstaffed, get out.'"); + "erstaffed, get out.'"); + "erstaffed, get out.'"); + "erstaffed, get out.'"); System. System. System.out.println("They kick you out of the buildi".println("They kick you out of the buildi".println("They kick you out of the buildi".println("They kick you out of the buildi".println("They kick you out of the buildi".println("They kick you out of the buildi" + "ng and you go about your way."); + "ng and you go about your way."); + "ng and you go about your way."); + "ng and you go about your way."); + "ng and you go about your way."); + "ng and you go about your way."); + "ng and you go about your way."); + "ng and you go about your way."); System. System. System.out.println("'Thanks obama' You think.");.println("'Thanks obama' You think.");.println("'Thanks obama' You think.");.println("'Thanks obama' You think.");.println("'Thanks obama' You think.");.println("'Thanks obama' You think.");.println("'Thanks obama' You think.");.println("'Thanks obama' You think."); scan++; scan++; scan++; scan++; } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Pleas enter a number!");.println("Pleas enter a number!");.println("Pleas enter a number!");.println("Pleas enter a number!");.println("Pleas enter a number!");.println("Pleas enter a number!");.println("Pleas enter a number!");.println("Pleas enter a number!"); } } } } break; break; break; } } } } } }}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/variableSection.java

2.1 of 2 2014.12.03 13:26:55

Page 80: Text adventure

12345678910111213141516171819202122232425262728293031323334

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class upOrDown { {

public static void public static void public static void public static void public static void public static void public static void upOrDownKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in););

System. System. System.out.println("Which number do you wish to be the example? ".println("Which number do you wish to be the example? ".println("Which number do you wish to be the example? ".println("Which number do you wish to be the example? ".println("Which number do you wish to be the example? ".println("Which number do you wish to be the example? " + "preferably a decimal"); + "preferably a decimal"); + "preferably a decimal"); + "preferably a decimal"); + "preferably a decimal"); + "preferably a decimal"); + "preferably a decimal"); + "preferably a decimal"); + "preferably a decimal"); double dob = in.nextDouble(); double dob = in.nextDouble(); double dob = in.nextDouble(); double dob = in.nextDouble(); double dob = in.nextDouble(); double dob = in.nextDouble(); double dob = in.nextDouble(); double dob = in.nextDouble(); double dob = in.nextDouble(); double dob = in.nextDouble(); double dob = in.nextDouble(); double dob = in.nextDouble(); double dob = in.nextDouble(); double dob = in.nextDouble(); int up = (int) Math. int up = (int) Math. int up = (int) Math. int up = (int) Math. int up = (int) Math. int up = (int) Math. int up = (int) Math. int up = (int) Math. int up = (int) Math. int up = (int) Math. int up = (int) Math. int up = (int) Math. int up = (int) Math.ceil(dob);(dob);(dob);(dob); int down = (int) Math. int down = (int) Math. int down = (int) Math. int down = (int) Math. int down = (int) Math. int down = (int) Math. int down = (int) Math. int down = (int) Math. int down = (int) Math. int down = (int) Math. int down = (int) Math. int down = (int) Math. int down = (int) Math.floor(dob); // math opperations need math.X(N)(dob); // math opperations need math.X(N)(dob); // math opperations need math.X(N)(dob); // math opperations need math.X(N)(dob); // math opperations need math.X(N)(dob); // math opperations need math.X(N) System. System. System.out.println("You explain how rounding this number up gets ".println("You explain how rounding this number up gets ".println("You explain how rounding this number up gets ".println("You explain how rounding this number up gets ".println("You explain how rounding this number up gets ".println("You explain how rounding this number up gets " + "you " + up); + "you " + up); + "you " + up); + "you " + up); + "you " + up); + "you " + up); + "you " + up); + "you " + up); + "you " + up); + "you " + up); + "you " + up); + "you " + up); System. System. System.out.println("You explain how rounding this number down gets ".println("You explain how rounding this number down gets ".println("You explain how rounding this number down gets ".println("You explain how rounding this number down gets ".println("You explain how rounding this number down gets ".println("You explain how rounding this number down gets " + "you " + down); + "you " + down); + "you " + down); + "you " + down); + "you " + down); + "you " + down); + "you " + down); + "you " + down); + "you " + down); + "you " + down); + "you " + down); + "you " + down);

} }

}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/upOrDown.java

1.1 of 1 2014.12.03 15:13:27

Page 81: Text adventure

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

public class public class public class public class whileLoops { {

public static void public static void public static void public static void public static void public static void public static void whileLoopsKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in););

int circus = 0; int circus = 0; int circus = 0; int circus = 0; int circus = 0; int circus = 0; int circus = 0; int circus = 0; int circus = 0; int scan = 0; int scan = 0; int scan = 0; int scan = 0; int scan = 0; int scan = 0; int scan = 0; int scan = 0; int scan = 0;

System. System. System.out.println("You walk into the while tent and see all manner of ".println("You walk into the while tent and see all manner of ".println("You walk into the while tent and see all manner of ".println("You walk into the while tent and see all manner of ".println("You walk into the while tent and see all manner of ".println("You walk into the while tent and see all manner of " + "creatures. A clown approaches you."); + "creatures. A clown approaches you."); + "creatures. A clown approaches you."); + "creatures. A clown approaches you."); + "creatures. A clown approaches you."); + "creatures. A clown approaches you."); + "creatures. A clown approaches you."); + "creatures. A clown approaches you."); System. System. System.out.println("Clown: 'I am so sorry dear patron but only three of".println("Clown: 'I am so sorry dear patron but only three of".println("Clown: 'I am so sorry dear patron but only three of".println("Clown: 'I am so sorry dear patron but only three of".println("Clown: 'I am so sorry dear patron but only three of".println("Clown: 'I am so sorry dear patron but only three of" + " our exhibits are open today. The letter counter, box game, " + " our exhibits are open today. The letter counter, box game, " + " our exhibits are open today. The letter counter, box game, " + " our exhibits are open today. The letter counter, box game, " + " our exhibits are open today. The letter counter, box game, " + " our exhibits are open today. The letter counter, box game, " + "and adding game."); + "and adding game."); + "and adding game."); + "and adding game."); + "and adding game."); + "and adding game."); + "and adding game."); + "and adding game."); while (circus != 4) { while (circus != 4) { while (circus != 4) { while (circus != 4) { while (circus != 4) { while (circus != 4) { while (circus != 4) { while (circus != 4) { while (circus != 4) { while (circus != 4) { while (circus != 4) { while (circus != 4) { scan = 0; scan = 0; scan = 0; scan = 0; scan = 0; scan = 0; scan = 0; System. System. System.out.println("Do you want to play 1: the letter counter, 2: t".println("Do you want to play 1: the letter counter, 2: t".println("Do you want to play 1: the letter counter, 2: t".println("Do you want to play 1: the letter counter, 2: t".println("Do you want to play 1: the letter counter, 2: t".println("Do you want to play 1: the letter counter, 2: t" + "he box game, 3: the adding game, or 4: leave?"); + "he box game, 3: the adding game, or 4: leave?"); + "he box game, 3: the adding game, or 4: leave?"); + "he box game, 3: the adding game, or 4: leave?"); + "he box game, 3: the adding game, or 4: leave?"); + "he box game, 3: the adding game, or 4: leave?"); + "he box game, 3: the adding game, or 4: leave?"); + "he box game, 3: the adding game, or 4: leave?"); circus = in.nextInt(); circus = in.nextInt(); circus = in.nextInt(); circus = in.nextInt(); circus = in.nextInt(); circus = in.nextInt(); circus = in.nextInt(); circus = in.nextInt(); circus = in.nextInt(); circus = in.nextInt(); circus = in.nextInt(); switch (circus) { switch (circus) { switch (circus) { switch (circus) { switch (circus) { switch (circus) { switch (circus) { switch (circus) { case 1: case 1: case 1: case 1: case 1: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { System. System. System.out.println("Clown: 'Hello! Oh how I do love".println("Clown: 'Hello! Oh how I do love".println("Clown: 'Hello! Oh how I do love".println("Clown: 'Hello! Oh how I do love".println("Clown: 'Hello! Oh how I do love".println("Clown: 'Hello! Oh how I do love" + " the letter A. Give me a sentance I'll t" + " the letter A. Give me a sentance I'll t" + " the letter A. Give me a sentance I'll t" + " the letter A. Give me a sentance I'll t" + " the letter A. Give me a sentance I'll t" + " the letter A. Give me a sentance I'll t" + "ell you how many times A appears in it!" + "ell you how many times A appears in it!" + "ell you how many times A appears in it!" + "ell you how many times A appears in it!" + "ell you how many times A appears in it!" + "ell you how many times A appears in it!" + ""); + ""); + ""); + ""); + ""); + ""); numberOfAs. numberOfAs. numberOfAs.numberOfAsKing();();(); scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number"); } } } } break; break; break; case 2: case 2: case 2: case 2: case 2: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { System. System. System.out.println("You enter the room and see a ra".println("You enter the room and see a ra".println("You enter the room and see a ra".println("You enter the room and see a ra".println("You enter the room and see a ra".println("You enter the room and see a ra" + "ther annoyed looking clown."); + "ther annoyed looking clown."); + "ther annoyed looking clown."); + "ther annoyed looking clown."); + "ther annoyed looking clown."); + "ther annoyed looking clown."); + "ther annoyed looking clown."); + "ther annoyed looking clown."); System. System. System.out.println("Clown: 'yes welcome to the box ".println("Clown: 'yes welcome to the box ".println("Clown: 'yes welcome to the box ".println("Clown: 'yes welcome to the box ".println("Clown: 'yes welcome to the box ".println("Clown: 'yes welcome to the box " + "game I just need a little info from you " + "game I just need a little info from you " + "game I just need a little info from you " + "game I just need a little info from you " + "game I just need a little info from you " + "game I just need a little info from you " + "to play.'"); + "to play.'"); + "to play.'"); + "to play.'"); + "to play.'"); + "to play.'"); + "to play.'"); + "to play.'"); System. System. System.out.println("You ask why the clown sounds so".println("You ask why the clown sounds so".println("You ask why the clown sounds so".println("You ask why the clown sounds so".println("You ask why the clown sounds so".println("You ask why the clown sounds so" + " annoyed."); + " annoyed."); + " annoyed."); + " annoyed."); + " annoyed."); + " annoyed."); + " annoyed."); + " annoyed."); System. System. System.out.println("Clown: 'Just answer the questio".println("Clown: 'Just answer the questio".println("Clown: 'Just answer the questio".println("Clown: 'Just answer the questio".println("Clown: 'Just answer the questio".println("Clown: 'Just answer the questio" + "ns and you'll see.'"); + "ns and you'll see.'"); + "ns and you'll see.'"); + "ns and you'll see.'"); + "ns and you'll see.'"); + "ns and you'll see.'"); + "ns and you'll see.'"); + "ns and you'll see.'"); boxOfNumbers. boxOfNumbers. boxOfNumbers.boxOfNumbersKing();();(); System. System. System.out.println("Clown: 'Do you see how pointles".println("Clown: 'Do you see how pointles".println("Clown: 'Do you see how pointles".println("Clown: 'Do you see how pointles".println("Clown: 'Do you see how pointles".println("Clown: 'Do you see how pointles" + "s that was, this is what i do all day ev" + "s that was, this is what i do all day ev" + "s that was, this is what i do all day ev" + "s that was, this is what i do all day ev" + "s that was, this is what i do all day ev" + "s that was, this is what i do all day ev" + "ery day.'"); + "ery day.'"); + "ery day.'"); + "ery day.'"); + "ery day.'"); + "ery day.'"); + "ery day.'"); + "ery day.'"); System. System. System.out.println("Beofre you can ask the clown wh".println("Beofre you can ask the clown wh".println("Beofre you can ask the clown wh".println("Beofre you can ask the clown wh".println("Beofre you can ask the clown wh".println("Beofre you can ask the clown wh" + "y he doesn't quit he says:"); + "y he doesn't quit he says:"); + "y he doesn't quit he says:"); + "y he doesn't quit he says:"); + "y he doesn't quit he says:"); + "y he doesn't quit he says:"); + "y he doesn't quit he says:"); + "y he doesn't quit he says:"); System. System. System.out.println("Clown: 'Just leave there's 20 m".println("Clown: 'Just leave there's 20 m".println("Clown: 'Just leave there's 20 m".println("Clown: 'Just leave there's 20 m".println("Clown: 'Just leave there's 20 m".println("Clown: 'Just leave there's 20 m" + "ore people behind you.'"); + "ore people behind you.'"); + "ore people behind you.'"); + "ore people behind you.'"); + "ore people behind you.'"); + "ore people behind you.'"); + "ore people behind you.'"); + "ore people behind you.'"); scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number"); } } } }

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/whileLoops.java

1.1 of 2 2014.12.03 15:05:32

Page 82: Text adventure

737475767778798081828384858687888990919293949596979899

} } break; break; break; case 3: case 3: case 3: case 3: case 3: while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { while (scan != 1) { try { try { try { try { System. System. System.out.println("You walk into the room and find".println("You walk into the room and find".println("You walk into the room and find".println("You walk into the room and find".println("You walk into the room and find".println("You walk into the room and find" + " a clown with a clip board standing in t" + " a clown with a clip board standing in t" + " a clown with a clip board standing in t" + " a clown with a clip board standing in t" + " a clown with a clip board standing in t" + " a clown with a clip board standing in t" + "he room."); + "he room."); + "he room."); + "he room."); + "he room."); + "he room."); + "he room."); + "he room."); System. System. System.out.println("Clown: 'Yes come along I have a".println("Clown: 'Yes come along I have a".println("Clown: 'Yes come along I have a".println("Clown: 'Yes come along I have a".println("Clown: 'Yes come along I have a".println("Clown: 'Yes come along I have a" + " few questions before the game can begin" + " few questions before the game can begin" + " few questions before the game can begin" + " few questions before the game can begin" + " few questions before the game can begin" + " few questions before the game can begin" + ".'"); + ".'"); + ".'"); + ".'"); + ".'"); + ".'"); + ".'"); + ".'"); addingFiveIntegers. addingFiveIntegers. addingFiveIntegers.addingFiveIntegersKing();();(); System. System. System.out.println("Before you can bring up that th".println("Before you can bring up that th".println("Before you can bring up that th".println("Before you can bring up that th".println("Before you can bring up that th".println("Before you can bring up that th" + "is wasn't a game he kicks you out of his" + "is wasn't a game he kicks you out of his" + "is wasn't a game he kicks you out of his" + "is wasn't a game he kicks you out of his" + "is wasn't a game he kicks you out of his" + "is wasn't a game he kicks you out of his" + " tent."); + " tent."); + " tent."); + " tent."); + " tent."); + " tent."); + " tent."); + " tent."); scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop scan++; // kills loop } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { } catch (Exception e) { System. System. System.out.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number");.println("Please enter a number"); } } } } break; break; break;

} } } } } }}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/whileLoops.java

2.1 of 2 2014.12.03 15:05:32

Page 83: Text adventure

1234567891011121314151617181920212223242526272829303132

34353637383940414243444546474849505152535455565758

//**********************************************************// 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 // program code. I received help from Prof. Vanselow // in designing and debugging my program.//*********************************************************package finale;package finale;package finale;package finale;

import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;import java.util.Scanner;

class class xAndY { {

public static void public static void public static void public static void public static void public static void public static void xAndYKing() {() {() {() { Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System. Scanner in = new Scanner(System.in););

System. System. System.out.println("Soldier: 'Enter x coordinate'");.println("Soldier: 'Enter x coordinate'");.println("Soldier: 'Enter x coordinate'");.println("Soldier: 'Enter x coordinate'");.println("Soldier: 'Enter x coordinate'");.println("Soldier: 'Enter x coordinate'");.println("Soldier: 'Enter x coordinate'");.println("Soldier: 'Enter x coordinate'"); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); int num1 = in.nextInt(); System. System. System.out.println("Soldier: 'Enter y coordinate'");.println("Soldier: 'Enter y coordinate'");.println("Soldier: 'Enter y coordinate'");.println("Soldier: 'Enter y coordinate'");.println("Soldier: 'Enter y coordinate'");.println("Soldier: 'Enter y coordinate'");.println("Soldier: 'Enter y coordinate'");.println("Soldier: 'Enter y coordinate'"); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); int num2 = in.nextInt(); Point point = new Point(num1, num2); Point point = new Point(num1, num2); Point point = new Point(num1, num2); Point point = new Point(num1, num2); Point point = new Point(num1, num2); Point point = new Point(num1, num2); Point point = new Point(num1, num2); Point point = new Point(num1, num2); Point point = new Point(num1, num2); Point point = new Point(num1, num2); Point point = new Point(num1, num2); Point point = new Point(num1, num2); Point point = new Point(num1, num2); Point point = new Point(num1, num2); Point point = new Point(num1, num2); Point point = new Point(num1, num2); Point point = new Point(num1, num2); System. System. System.out.println("Soldier: 'It's in quadrant " + point.quadrant() + "".println("Soldier: 'It's in quadrant " + point.quadrant() + "".println("Soldier: 'It's in quadrant " + point.quadrant() + "".println("Soldier: 'It's in quadrant " + point.quadrant() + "".println("Soldier: 'It's in quadrant " + point.quadrant() + "".println("Soldier: 'It's in quadrant " + point.quadrant() + "".println("Soldier: 'It's in quadrant " + point.quadrant() + "".println("Soldier: 'It's in quadrant " + point.quadrant() + "".println("Soldier: 'It's in quadrant " + point.quadrant() + "".println("Soldier: 'It's in quadrant " + point.quadrant() + "".println("Soldier: 'It's in quadrant " + point.quadrant() + "".println("Soldier: 'It's in quadrant " + point.quadrant() + "".println("Soldier: 'It's in quadrant " + point.quadrant() + "".println("Soldier: 'It's in quadrant " + point.quadrant() + "".println("Soldier: 'It's in quadrant " + point.quadrant() + "".println("Soldier: 'It's in quadrant " + point.quadrant() + "".println("Soldier: 'It's in quadrant " + point.quadrant() + "".println("Soldier: 'It's in quadrant " + point.quadrant() + "" + "'"); + "'"); + "'"); + "'"); + "'"); + "'"); + "'"); + "'"); } }}

class class Point { {

private int x, y; private int x, y; private int x, y; private int x, y; private int x, y; private int x, y; private int x, y; private int x, y; private int x, y; private int x, y;

public public public Point(int num1, int num2) {(int num1, int num2) {(int num1, int num2) {(int num1, int num2) {(int num1, int num2) {(int num1, int num2) {(int num1, int num2) {(int num1, int num2) {(int num1, int num2) {(int num1, int num2) {(int num1, int num2) {(int num1, int num2) { x = num1; x = num1; x = num1; x = num1; x = num1; x = num1; x = num1; y = num2; y = num2; y = num2; y = num2; y = num2; y = num2; y = num2; } }

public int public int public int public int public int quadrant() { () { () { () { () { // determines the quadrant // determines the quadrant int quadrant = 0; int quadrant = 0; int quadrant = 0; int quadrant = 0; int quadrant = 0; int quadrant = 0; int quadrant = 0; int quadrant = 0; int quadrant = 0; if (x > 0 && y > 0) { if (x > 0 && y > 0) { if (x > 0 && y > 0) { if (x > 0 && y > 0) { if (x > 0 && y > 0) { if (x > 0 && y > 0) { if (x > 0 && y > 0) { if (x > 0 && y > 0) { if (x > 0 && y > 0) { if (x > 0 && y > 0) { if (x > 0 && y > 0) { if (x > 0 && y > 0) { if (x > 0 && y > 0) { if (x > 0 && y > 0) { if (x > 0 && y > 0) { if (x > 0 && y > 0) { if (x > 0 && y > 0) { if (x > 0 && y > 0) { if (x > 0 && y > 0) { if (x > 0 && y > 0) { quadrant = 1; quadrant = 1; quadrant = 1; quadrant = 1; quadrant = 1; quadrant = 1; quadrant = 1; } else if (x < 0 && y > 0) { } else if (x < 0 && y > 0) { } else if (x < 0 && y > 0) { } else if (x < 0 && y > 0) { } else if (x < 0 && y > 0) { } else if (x < 0 && y > 0) { } else if (x < 0 && y > 0) { } else if (x < 0 && y > 0) { } else if (x < 0 && y > 0) { } else if (x < 0 && y > 0) { } else if (x < 0 && y > 0) { } else if (x < 0 && y > 0) { } else if (x < 0 && y > 0) { } else if (x < 0 && y > 0) { } else if (x < 0 && y > 0) { } else if (x < 0 && y > 0) { } else if (x < 0 && y > 0) { } else if (x < 0 && y > 0) { } else if (x < 0 && y > 0) { } else if (x < 0 && y > 0) { } else if (x < 0 && y > 0) { } else if (x < 0 && y > 0) { } else if (x < 0 && y > 0) { } else if (x < 0 && y > 0) { quadrant = 2; quadrant = 2; quadrant = 2; quadrant = 2; quadrant = 2; quadrant = 2; quadrant = 2; } else if (x < 0 && y < 0) { } else if (x < 0 && y < 0) { } else if (x < 0 && y < 0) { } else if (x < 0 && y < 0) { } else if (x < 0 && y < 0) { } else if (x < 0 && y < 0) { } else if (x < 0 && y < 0) { } else if (x < 0 && y < 0) { } else if (x < 0 && y < 0) { } else if (x < 0 && y < 0) { } else if (x < 0 && y < 0) { } else if (x < 0 && y < 0) { } else if (x < 0 && y < 0) { } else if (x < 0 && y < 0) { } else if (x < 0 && y < 0) { } else if (x < 0 && y < 0) { } else if (x < 0 && y < 0) { } else if (x < 0 && y < 0) { } else if (x < 0 && y < 0) { } else if (x < 0 && y < 0) { } else if (x < 0 && y < 0) { } else if (x < 0 && y < 0) { } else if (x < 0 && y < 0) { } else if (x < 0 && y < 0) { quadrant = 3; quadrant = 3; quadrant = 3; quadrant = 3; quadrant = 3; quadrant = 3; quadrant = 3; } else if (x > 0 && y < 0) { } else if (x > 0 && y < 0) { } else if (x > 0 && y < 0) { } else if (x > 0 && y < 0) { } else if (x > 0 && y < 0) { } else if (x > 0 && y < 0) { } else if (x > 0 && y < 0) { } else if (x > 0 && y < 0) { } else if (x > 0 && y < 0) { } else if (x > 0 && y < 0) { } else if (x > 0 && y < 0) { } else if (x > 0 && y < 0) { } else if (x > 0 && y < 0) { } else if (x > 0 && y < 0) { } else if (x > 0 && y < 0) { } else if (x > 0 && y < 0) { } else if (x > 0 && y < 0) { } else if (x > 0 && y < 0) { } else if (x > 0 && y < 0) { } else if (x > 0 && y < 0) { } else if (x > 0 && y < 0) { } else if (x > 0 && y < 0) { } else if (x > 0 && y < 0) { } else if (x > 0 && y < 0) { quadrant = 4; quadrant = 4; quadrant = 4; quadrant = 4; quadrant = 4; quadrant = 4; quadrant = 4; } else if (x == 0 || y == 0) { } else if (x == 0 || y == 0) { } else if (x == 0 || y == 0) { } else if (x == 0 || y == 0) { } else if (x == 0 || y == 0) { } else if (x == 0 || y == 0) { } else if (x == 0 || y == 0) { } else if (x == 0 || y == 0) { } else if (x == 0 || y == 0) { } else if (x == 0 || y == 0) { } else if (x == 0 || y == 0) { } else if (x == 0 || y == 0) { } else if (x == 0 || y == 0) { } else if (x == 0 || y == 0) { } else if (x == 0 || y == 0) { } else if (x == 0 || y == 0) { } else if (x == 0 || y == 0) { } else if (x == 0 || y == 0) { } else if (x == 0 || y == 0) { } else if (x == 0 || y == 0) { } else if (x == 0 || y == 0) { } else if (x == 0 || y == 0) { } else if (x == 0 || y == 0) { } else if (x == 0 || y == 0) { System. System. System.out.println("This is on an axis.");.println("This is on an axis.");.println("This is on an axis.");.println("This is on an axis.");.println("This is on an axis.");.println("This is on an axis.");.println("This is on an axis.");.println("This is on an axis."); } } return quadrant; return quadrant; return quadrant; return quadrant; return quadrant; } }

}

/Users/AndrewMacKoul/NetBeansProjects/finale/src/finale/xAndY.java

1.1 of 1 2014.12.03 14:34:50