Skip to main content
Code Review

Return to Answer

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

One of the suggestions I would make (immediately) is to, instead of hardcoding things, build a Map<string, string> (or if order is important, TreeMap<string, string>) that contains possible inputs, and their expected outputs (see this answer on SO this answer on SO). (Or a database, which is more extensible.)

One of the suggestions I would make (immediately) is to, instead of hardcoding things, build a Map<string, string> (or if order is important, TreeMap<string, string>) that contains possible inputs, and their expected outputs (see this answer on SO). (Or a database, which is more extensible.)

One of the suggestions I would make (immediately) is to, instead of hardcoding things, build a Map<string, string> (or if order is important, TreeMap<string, string>) that contains possible inputs, and their expected outputs (see this answer on SO). (Or a database, which is more extensible.)

added 99 characters in body; deleted 8 characters in body
Source Link
Der Kommissar
  • 20.3k
  • 4
  • 70
  • 158
switch (start.nextInt(5))
{
 case 0:
 System.out.println("Well? Are you going to answer my question? Yes or No?! Please don't use punctuation or capital letters, because I don't really understand them.");
 break;
 case 1:
 System.out.println("Hi. I'm Typingbot. Please don't use punctuation or capital letters, because I don't really understand them.");
 break;
 case 2:
 System.out.println("Welcome to Narnia, young one. Please don't use punctuation or capital letters, because I don't really understand them.");
 break;
 case 3:
 System.out.println("Let's play a game. What do you want to play? Please don't use punctuation or capital letters, because I don't really understand them.");
 break;
  case 4:
 System.out.println("Let's fight! pulls out pistol. Please don't use punctuation or capital letters, because I don't really understand them.");
 break;
}
switch (start.nextInt(5))
{
 case 0:
 System.out.println("Well? Are you going to answer my question? Yes or No?! Please don't use punctuation or capital letters, because I don't really understand them.");
 case 1:
 System.out.println("Hi. I'm Typingbot. Please don't use punctuation or capital letters, because I don't really understand them.");
 case 2:
 System.out.println("Welcome to Narnia, young one. Please don't use punctuation or capital letters, because I don't really understand them.");
 case 3:
 System.out.println("Let's play a game. What do you want to play? Please don't use punctuation or capital letters, because I don't really understand them.");
 case 4:
 System.out.println("Let's fight! pulls out pistol. Please don't use punctuation or capital letters, because I don't really understand them.");
}
switch (start.nextInt(5))
{
 case 0:
 System.out.println("Well? Are you going to answer my question? Yes or No?! Please don't use punctuation or capital letters, because I don't really understand them.");
 break;
 case 1:
 System.out.println("Hi. I'm Typingbot. Please don't use punctuation or capital letters, because I don't really understand them.");
 break;
 case 2:
 System.out.println("Welcome to Narnia, young one. Please don't use punctuation or capital letters, because I don't really understand them.");
 break;
 case 3:
 System.out.println("Let's play a game. What do you want to play? Please don't use punctuation or capital letters, because I don't really understand them.");
 break;
  case 4:
 System.out.println("Let's fight! pulls out pistol. Please don't use punctuation or capital letters, because I don't really understand them.");
 break;
}
added 230 characters in body
Source Link
Der Kommissar
  • 20.3k
  • 4
  • 70
  • 158

I would then (if not using a database) build a file with a structure that you can read in and have it dynamically populate the Map.

You should also consider a class for this, as it will allow you to have more flexibility.

Can be a switch on (noidont.nextInt(1)), or just a single if/else (if (noidont.nextInt(1) == 1). This is because you only have two possible values, so if it doesn't meet the first one, it's guaranteed to meet the second.


You should also name your variables either camelCase, or PascalCase. (noIDont)

Can be a switch on (noidont.nextInt(1)). You should also name your variables either camelCase, or PascalCase. (noIDont)

I would then (if not using a database) build a file with a structure that you can read in and have it dynamically populate the Map.

You should also consider a class for this, as it will allow you to have more flexibility.

Can be a switch on (noidont.nextInt(1)), or just a single if/else (if (noidont.nextInt(1) == 1). This is because you only have two possible values, so if it doesn't meet the first one, it's guaranteed to meet the second.


You should also name your variables either camelCase, or PascalCase. (noIDont)

added 43 characters in body
Source Link
Der Kommissar
  • 20.3k
  • 4
  • 70
  • 158
Loading
Source Link
Der Kommissar
  • 20.3k
  • 4
  • 70
  • 158
Loading
lang-java

AltStyle によって変換されたページ (->オリジナル) /