-
Notifications
You must be signed in to change notification settings - Fork 7
not all #9
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
base: master
Are you sure you want to change the base?
not all #9
Conversation
| return ""; | ||
|
|
||
|
|
||
| if (phrase.equals(phrase.toUpperCase()) ) { |
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.
The thing is, that "1 2 3".toUpperCase() is the same as 1 2 3.
There are two ways, first one - use regexp figure out whether string contains upper case letters. Second one - additionally use toLowerCase().
| if (phrase.equals(phrase.toUpperCase()) ) { | ||
| return "Chill out!"; | ||
| } | ||
| else if (phrase.endsWith("?")) { |
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.
Please format your code.
| import java.util.Scanner; | ||
|
|
||
| public class ConsoleCalculator { | ||
| public int Add(int scannetFirstNumInt, int scannetSecondNumInt, String scannerOperations) { |
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.
Please use lowerCamelCase for method names https://ru.wikipedia.org/wiki/CamelCase
Also please use static for this methods, so it won't be needed to create instance of ConsoleCalculator
|
|
||
| System.out.println("Result of" + resultat); | ||
| System.out.println("Make your choice."); | ||
| Scanner scannerOperationsSecond = new Scanner(System.in); |
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.
One scanner will be enough for reading all numbers and operations, so no reason to create another one.
| System.out.println("Make your choice."); | ||
| Scanner scannerOperations = new Scanner(System.in); | ||
|
|
||
|
|
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.
User should have possibility to do more than one operations, so there should be a loop, until user enter exit.
1 done, 2 with some problem, without calculator