Java Programming Tutorial - Building a Basic Calculator

Veröffentlicht am: 18 Dezember 2020
auf dem Kanal: Arfisto !
719
13

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:
   • Java Tutorials  

►Subscribe to this channel to get video updates.    / arfisto  

Follow Us On Social Media
►Facebook -   / arfisto.youtube  
►Instagram -   / arfisto  
►Twitter -   / arfisto  

For any question/query, you can always comment above or write us on arfisto6@gmail.com


Auf dieser Seite können Sie das Online-Video Java Programming Tutorial - Building a Basic Calculator mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Arfisto ! 18 Dezember 2020 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 719 Mal angesehen und es wurde von 13 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!