Java Tutorial - This video will help you in understanding that how you can create a simple Calculator. We will develop/Create this calculator using the Java switch case. This Calculator will be able to preform operation like, +, -, *, / of any entered number from the user. WATCH NOW
#JAVA #Calculator #JavaTutorials
Code For The Calculator :
----------------------------------------
import java.util.Scanner;
public class Calculator{
public static void main (String[] args){
double num1;
double num2;
char operators;
double Result;
Scanner Input = new Scanner(System.in);
System.out.println("Enter the first no");
num1 = Input.nextDouble();
System.out.println("Enter the second no");
num2 = Input.nextDouble();
System.out.println("+, -, *, /");
System.out.println("Enter your preferred option");
operators = Input.next().charAt(0);
switch(operators){
case '+' :Result= num1+num2;
break;
case '-' :Result= num1-num2;
break;
case '*' :Result= num1*num2;
break;
case '/' :Result= num1/num2;
break;
default: System.out.println("Error! try again");
return;
}
System.out.println(num1 + "" + operators + "" + num2 + " = " + Result );
}
}
----------------------------------------
Agenda for the video:
Java Programming Tutorial - simple calculator
Basic Calculator using switch case in java,
Calculator using switch
Usage of Scanner Class
How to create objects in java
Use of switch case
►Check the Java playlist here:
[ Ссылка ]
►Subscribe to this channel to get video updates. [ Ссылка ]
Follow Us On Social Media
►Facebook - [ Ссылка ]
►Instagram - [ Ссылка ]
►Twitter - [ Ссылка ]
For any question/query, you can always comment above or write us on arfisto6@gmail.com
![](https://i.ytimg.com/vi/AhUvpfLrfbg/maxresdefault.jpg)