Skip to content
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

MethodSwitch 1 #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

MethodSwitch 1 #2

wants to merge 3 commits into from

Conversation

froschs
Copy link

@froschs froschs commented Sep 18, 2015

First publish of the MethodSwitch program.

First publish of the MethodSwitch program.
@stevenPlas
Copy link

The only thing I noticed, is you forgot to do the comments on your functions by using the /** "enter" that he showed in class this week.
But other than that it looks like nice and clean code, and I like the use of the switch statement.

Added comments to the MethodSwitch program.
@froschs
Copy link
Author

froschs commented Sep 18, 2015

Thanks Steven. Got carried away with formatting what became some pretty sloppy code and forgot all about comments.

System.out.println("Enter '1' to play FIZZBUZZ.\n" + "Enter '2' to view the value of your chosen word.\n" + "Enter '3' to use the salary calculator.\n"
+ "Enter '4' to check your grade.\n" + "Enter '5' to play Truth or Dare.\n" + "Enter '6' or any other number to EXIT.");
number = keyboard.nextInt();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If each menu item were on a separate line, it would make reading and editing it much easier.

@srtinkey
Copy link

Nice program, neat and easy to read (except where noted).

Changed formatting in the MethodSwitch program to make menu items easier
to read.
System.out.println("Enter 'Truth' or 'Dare':");
response = keyboard.next();

if (response.equalsIgnoreCase("TRUTH")){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These truth or dare literals are perfect opportunities to use constants within your function.

final String TRUTH = "truth";
final String DARE = "dare";

if(response.equalsIgnoreCase(TRUTH)){}
if(response.equalsIgnoreCase(DARE)){}

No requirement to make this change just a way of thinking about it. I felt this "TRUTH" variable was almost screaming out like you wanted it to be a constant 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants