Skip to content

Conversation

@dianasinenchenko
Copy link

1 done, 2 with some problem, without calculator

@didva didva self-assigned this Dec 2, 2016
return "";


if (phrase.equals(phrase.toUpperCase()) ) {
Copy link

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("?")) {
Copy link

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) {
Copy link

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);
Copy link

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);


Copy link

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.

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.

2 participants