Building a better Calculator | Java | Tutorial 17

preview_player
Показать описание

Throughout the course we'll be looking at various topics including variables, arrays, getting user input, loops, conditionals, object orientation, and much more.
Рекомендации по теме
Комментарии
Автор

If people just watch his vids, they'll learn easily in just one watch.

pizzacookie
Автор

For those who do not get the output, use this:

Scanner keyboardInput = new Scanner(System.in);
System.out.print("Enter a number: ");
double num1 = keyboardInput.nextDouble();

System.out.print("Enter another number: ");
double num2 = keyboardInput.nextDouble();

System.out.print("Enter an operator: ");
char op =

if(op == '+') {
System.out.println(num1 + num2);
}
else if(op == '-') {
System.out.println(num1 - num2);
}
else if(op == '*') {
System.out.println(num1 * num2);
}
else if(op == '/'){
System.out.println(num1 / num2);
}
else {
Operator!");
}

karencastelino
Автор

what about taking in the whole expression on one input and parsing it all at once? what about adding exponents and quantities using parenthesis? order of operations? PEMDAS?? How would one implement all of that?

ianfischer
Автор

Why does, if{op == "+"}, does not work but op.equals does ?

AjitSingh-orml
Автор

2++2, when i press "+" more than one time consecutively it should not add another plus sign. below is my code of calculator

msvralee
Автор

very dynamic, extremely complicated programming language me think

ihssancanmturk
Автор

Can you please tell me after get the result how can I clear the field. What is the method of clearing field?

talhachy
Автор

It does not work. The program executes only the else statement.

kanchohristov