Saturday, 19 September 2020

CALCULATOR WITH JAVA

 SIMPLE CALCULATOR

JAVA CODING  

  • ELEMENTS OF JAVA USED IN PROGRAMMING -:

1.) double ---> It is a data type in java that can store decimal numbers. The decimals number in this data type can store numbers up to 15 decimal places. 

2.) char----->It is a data type in java that stores a single character or letter in java. 

3.) import --->It is a statement in java that helps the user to import a particular set of files (pre-installed in java) to help the user to access different features in java.

4.) if else STATEMENT---> They are the conditional statements that are preferred to execute a particular statement when an number of possible paths are available for the program to be executed. 

5.)  (a) switch STATEMENT--->It is the statement that executes a single code out according to the condition specified by the user, out of a number of possible executable codes.

     (b) break STATEMENT---> When the program finds an appropriate statement according to the user's input, and if and after the statement "break"  is written then from that point the program doesn't checks any other case. This helps to save time and the work becomes easy.

6.) System.out.println()----->This command helps the user to print a particular value or displays a particular enclosed statement. 


  • NOTE-:

  1. CASE of letter must not be ignored.
  2. Anyone not having idea of switch statement should check it as stated below.
  3. This program is a user input program.
  4. After end of every statement remember to close it with semicolon sign i.e. ;
  5. none of the special character should be ignored.

  • PROGRAMING-:

package comnditionalstatement;

import java.util.Scanner;

public class Calculator {


public static void main (String[]args) {

   Scanner sc= new Scanner (System.in);

           System.out.println("Enter the first number");

   double firstNum = sc.nextFloat();


           System.out.println("Enter the second number");

   double secondNum= sc.nextFloat();

System.out.println("Enter the sign of the operator ( +, - , * , / ) to be used");

char operator = sc.next().charAt(0);

double result = 0;

  switch (operator) {

  case '+': 

result = firstNum+secondNum;

      break;

      

        case '-': 

result = firstNum-secondNum;

      break;

      

        case '/':

result = firstNum/secondNum;

     break;

     

        case '*':

result = firstNum*secondNum;

break;

}

         if (operator == '+' || operator == '-' || operator == '/' || operator == '*' ) {

System.out.println("the result of the operation performed is " + result );

}

else {

System.out.println("Error the operation performed is not valid");

}

sc.close();

}

}

NOTE-: The set-up file that we import here is Scanner file and the name of the set-up file is "java.util.Scanner" it is a type of set-up file that helps user to input data.


  • PROGRAMING IMAGE-:

IMAGE-1




IMAGE-2 



NOTE-: Image how to use a switch statement-:



  • INPUT AND OUTPUT IMAGE IN CONSOLE-:
OUTPUT-1




 OUTPUT-2



THANK YOU 😌

FOR VISITING 

  PLEASE DO FOLLOW OUR PAGE👱








Tuesday, 25 August 2020

JAVA PROGRAMMING FOR CALCULATING SIMPLE INTEREST (USER INPUT)

 SIMPLE INTEREST

CALCULATION IN JAVA



  • ELEMENTS OF JAVA USED IN PROGRAMMING-: 

  1. int----->It is a data type that helps the user to assign a numerical value to a specific variable in a particular program.                                                             
  2. float---> It is a data type that helps the user to assign a decimal value to a specific variable in a particular program.                                                                NOTE-: Here you can also use "double" in place of "float" as this can store larger value than float.                                                                                           
  3. import--->It is the command that is used to import a particular set of files (pre installed in java ) to help the user to access different features of java.                 
  4. System.out.println()---> This command helps the user to print a particular value or displays a particular enclosed statement.                                            
  5. [ ; ]-----> This particular (symbol enclosed in square brackets ) i.e semicolon in java represents that a particular statement written by you is complete. 

  • NOTE-:

  1. CASE of letters must not be ignored.
  2. This program is a user input program. 
  3. After end of every statement  remember to close it with semicolon sign i.e ;
  4. none of the special characters  should be ignored. 

  • PROGRAMMING -:

package learning;

import java.util.Scanner ;



public class SimpleIntrest {


public static void main(String[] args) {

Scanner sc = new Scanner(System.in) ;

 

int principal = sc.nextInt();

float interestRate = sc.nextFloat();

float time = sc.nextFloat();

 

float interest = principal*interestRate*time/100 ;

 

System.out.println(interest);

 

sc.close();

 


}


}


NOTE-: The set-up that we import here is Scanner file and the name of the set-up file is "java.util.Scanner "it is a type of set-up file that helps user to input data .



  • PROGRAMMING IMAGE -:


  • INPUT AND OUTPUT IMAGE IN CONSOLE-:

     Output-1

 


   Output-2



NOTE-:  As you enter the first number in the console press the "Enter key", by doing this the computer automatically assigns the entered value to the first variable that you specified in the above programming . Now when you enter the second number and do the same, it is assigned the second variable.

If you need simpler example of this type of input programming then click on this link 

                                      

THANK YOU😌

FOR VISITING

PLEASE DO FOLLOW OUR PAGE 👦












Sunday, 23 August 2020

JAVA PROGRAMMING FOR ADDITION OF NUMBERS USER INPUT

 USER INPUT ADDITION
IN JAVA

  • ELEMENTS OF JAVA USED IN PROGRAMMING-:

  • int ---> This command helps you to specify that the value assigned to a particular variable in the specific program is an INTEGER.                                    NOTE-: Here you can also use "byte" that is used to specify that the variable is a number but the value that it can contain is much smaller than "int" command.               
  • import--->This command helps you to import a specific file from setup that was pre-prepared by java to help user to use it's properties .                                             
  • System.out.print-:  This command prints the specified variable or the statement enclosed  by the user.                    
  • [ ; ] ----> This particular ( symbol enclosed in square brackets ) i.e semicolon in java represents that a particular statement written by you is complete. 

  • NOTE-:
  1. CASE of the letter must not be ignored.
  2. After end of every statement remember to close it with semicolon sign i.e ;
  3. None of the special characters should be ignored.

  • PROGRAMMING-:
    package userInput;

    import java.util.Scanner; 


     public class ScannerUserInput {


public static void main(String[] args) {

Scanner sc= new Scanner(System.in);

int  x= sc.nextInt();

int  y= sc.nextInt();

int  sum=x+y ;

System.out.println(sum);

sc.close();


}


}

NOTE-:Here you may add as many integers that the user needs to add.

NOTE-: The set-up that we import here is Scanner file and the name of the set-up file is "java.util.Scanner "it is a type of set-up file that helps user to input data .

  • PROGRAMMING IMAGE-:

  • INPUT & OUTPUT IMAGE IN CONSOLE-:
     Output-1

    Output-2

NOTE-:  As you enter the first number in the console press the "Enter key", by doing this the computer automatically assigns the entered value to the first variable that you specified in the above programming . Now when you enter the second number and do the same, it is assigned the second variable. 

 Here in Output-1
          x is assigned with value of "5"
      y is assigned with value of "6"

   In Output-2
          x is assigned with value of "25"
     y is assigned with value of "25"


THANK YOU😌

FOR VISITING

PLEASE DO FOLLOW OUR PAGE 👦







Thursday, 20 August 2020

JAVA PROGRAMMING FOR ADDING UP NUMBERS -:

ADDITION OF NUMBERS 

IN JAVA 

  • ELEMENTS OF JAVA USED IN PROGRAMMING -:

  • int      ---> This command  helps you to specify that the value that is assigned to     a particular variable in the specific  program is an INTEGER.
  •  System.out.println()---->This command helps you to print i.e print the result in the console as specified by you.
  •  [ ; ] ----> This particular ( symbol enclosed in square brackets ) i.e semicolon in java represents that a particular statement written by you is complete.     

       NOTE-:
  1. CASE of letter must not be ignored
  2.  After end of every statement remember to close it with semicolon sign i.e ;
  3. None of the special characters should be ignored. 

        

  • PROGRAMMING -:
     package learning;

     public class AditionForBlog {

public static void main(String[] args) {
int a = 3;
int b = 4;
int c = 6;
int sum = a+b+c ;
System.out.println(sum);

}

}
 

NOTE -: Here you can add as many integers as possible. 
  • PROGRAMMING IMAGE-:

  • OUTPUT IMAGE (IN CONSOLE)-:


THANK YOU😌
FOR VISITING
PLEASE  DO FOLLOW OUR PAGE👦






FIRST JAVA PROGRAM FOR BEGINNERS

 PRINTING "Hello World" IN JAVA-

The elements of java used in this programming are -:

  1. System.out.println() --->> This COMMAND prints the output that you enclose in the brackets()
             EX. System.out.println("YOUR NAME");

             NOTE-: 1. The case of the letters of must  not be ignored.
                            2. The special character must not be changed.

PROGRAMMING -:


  package introduction;


   public class Helloworld {


public static void main(String[] args) {

System.out.println("Hello World, Eclipse Downloaded")

;


}


}

  •     PROGRAMMING IMAGE-:

   


  • OUTPUT (IN CONSOLE) -:

   

  THANK YOU

FOR VISITING





Saturday, 8 August 2020

HOW TO INSTALL JAVA -:

 HOW TO INSTALL JAVA

TO EXECUTE JAVA PROGRAMMING IN YOUR PC YOU JUST NEED TO INSTALL JDK  APPLICATION. AFTER INSTALLING THIS EACH JAVA PROGRAMMING FROM ANY EDITOR WOULD RUN IN YOUR PC. 

1.Search for jdk download and then click on the first link.

STEP-1

2.Here you would get a number of option of JAVA Versions. Remember that you must search for JAVA      LTS (LONG TERM SUPPORT) version as this would last longer than the  rest.  

For now the latest version is JAVA SE(11) LTS   

3. Now click on JDK Download. This web page would be visible 

          

4. If you use IOS then download the link that shows mac-OS INSTALLER


FOR IOS

 OR If you have WINDOWS as your OS(Operating System 64 BIT ) then  click on the link 

 


5.After you click on  the link you  have to click on the check box and then click the download link available.

6.Now a page will open which will ask you for USERNAME and PASSWORD if you have an user Id then login, if not then click on CREATE A NEW ACCOUNT . It's just one time process . After creating your ID you could  use your e-mail as USERNAME and then enter the password.

7. When you click in "Sign in" your download will start.

THANK YOU FOR VISITING



Popular