-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assignment 4 - Methods #11
Open
DTkach
wants to merge
2
commits into
WCCCEDU:master
Choose a base branch
from
DTkach:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
/* | ||
Dylan Tkach | ||
Java Programming | ||
CPT-163-27 | ||
*/ | ||
package assignment.pkg2.menu; | ||
|
||
import java.util.Scanner; | ||
|
||
public class Assignment2Menu { | ||
|
||
public static void main(String[] args) { | ||
|
||
Scanner keyboard = new Scanner(System.in); | ||
|
||
//Initialize the menu selection to make the loop iterate once. | ||
int MenuSelection = 1; | ||
|
||
//Loop the menu until the user closes out of it. | ||
while(MenuSelection != 0){ | ||
System.out.println("|=====================================|\n" | ||
+"| Please choose one of the following: |\n" | ||
+"| |\n" | ||
+"| 1. Word Counter |\n" | ||
+"| 2. Is it heresy? |\n" | ||
+"| 3. List of Primarchs |\n" | ||
+"| 4. Frame of Reference |\n" | ||
+"| 5. Contact Info |\n" | ||
+"| Enter 0 to exit. |\n" | ||
+"|_____________________________________|"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like your menu layout. |
||
|
||
System.out.println("\nEnter your selection: "); | ||
MenuSelection = keyboard.nextInt(); | ||
|
||
System.out.println("\n\n"); | ||
|
||
|
||
switch (MenuSelection){ | ||
case 0: | ||
//Exits the program | ||
programExit(); | ||
break; | ||
case 1: | ||
wordCounter(); | ||
break; | ||
case 2: | ||
heresyCheck(); | ||
break; | ||
case 3: | ||
primarchList(); | ||
break; | ||
case 4: | ||
muchNeededContext(); | ||
break; | ||
case 5: | ||
credits(); | ||
break; | ||
default: | ||
//When the user enters a value other than those listed. | ||
youDidItWrong(); | ||
} | ||
|
||
} | ||
|
||
} | ||
|
||
|
||
public static void programExit(){ | ||
System.out.println("Thank you for using this program."); | ||
} | ||
|
||
public static void wordCounter(){ | ||
int charW = 'W'; | ||
int charA = 'A'; | ||
int charR = 'R'; | ||
int charH = 'H'; | ||
// A declared. | ||
int charM = 'M'; | ||
// M declared. | ||
int charE = 'E'; | ||
// R declared. | ||
|
||
int total = charW + charA + charR + charH + charA + charM + charM + charE + charR; | ||
|
||
System.out.println("You selected choice 1:\n"); | ||
System.out.println("The ASCII total of WARHAMMER is " + total + "."); | ||
} | ||
|
||
public static void heresyCheck(){ | ||
System.out.println("You selected choice 2:\n"); | ||
System.out.println("Is it heresy?\n\n\n"); | ||
System.out.println("Probably"); | ||
} | ||
|
||
public static void primarchList(){ | ||
System.out.println("You selected choice 3:\n"); | ||
System.out.println("List of Primarchs:\n" | ||
+"Horus, Lion El'Jonson, Fulgrim, Perturabo,\n" | ||
+"Jaghatai Khan, Leman Russ, Rogal Dorn,\n" | ||
+"Konrad Curze, Sanguinius, Ferrus Manus,\n" | ||
+"Angron, Roboute Guilliman, Mortarion,\n" | ||
+"Magnus, Lorgar, Vulkan, Corvus Cortax,\n" | ||
+"Alpharius Omegon."); | ||
} | ||
|
||
public static void muchNeededContext(){ | ||
System.out.println("You selected choice 4:\n"); | ||
System.out.println("This is all in reference to a tabletop"); | ||
System.out.println("game called called Warhammer 40k."); | ||
} | ||
|
||
public static void credits(){ | ||
System.out.println("You selected choice 5:\n"); | ||
System.out.println("This program was made by Dylan Tkach"); | ||
System.out.println("Github: DTkach"); | ||
System.out.println("Email: [email protected]"); | ||
} | ||
|
||
public static void youDidItWrong(){ | ||
System.out.println("Please enter an option 1 through 5 "); | ||
System.out.println("or enter 0 to quit."); | ||
} | ||
|
||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good program, but someone else may benefit from seeing more of your code commented. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my program, I used a getKeyboard() method here instead.