Java Program #34 - Make a Simple Calculator Using Switch Case in Java

Поделиться
HTML-код
  • Опубликовано: 10 дек 2024

Комментарии • 52

  • @programmingforbeginners7392
    @programmingforbeginners7392  Год назад +4

    Watch more such videos in below playlist:
    Java Tutorial: ruclips.net/p/PLhyraTKIsw5_WemVMvshNm-0aC7zfISCO
    Java Programs: ruclips.net/p/PLhyraTKIsw59nQJKvZTKmNK2aMxHwvLOa

  • @Hinoligy
    @Hinoligy Год назад +6

    This helped me understand switches more thx bro

  • @Nikhee8
    @Nikhee8 11 месяцев назад +4

    Wahh.... Brilliant job... Nice explanation.. Keep it up 💯👏

  • @SHIVAMKUMARSHARMA-ps3gl
    @SHIVAMKUMARSHARMA-ps3gl Год назад +2

    Write a program for calculators in java which performs addition, subtraction, multiplication and division of any two numbers. Take user input using Scanner class and print the results of every calculation.
    do it

  • @me_master_meme
    @me_master_meme Год назад +8

    Your explanation is very good keep going : )

  • @khushisingh4584
    @khushisingh4584 Год назад +4

    Thanks for the video it helped me a lot ❤️

  • @roll20nilaydasgupta41
    @roll20nilaydasgupta41 3 месяца назад +1

    How we can do the arithmetic operation???
    Eg - 1+2-5(3*4)

  • @SuperWaqas007
    @SuperWaqas007 4 месяца назад +2

    so much thank full to you sir...

  • @Simranrajpoot_ಠ_ಠ
    @Simranrajpoot_ಠ_ಠ Месяц назад +1

    Is this the only method using switch case
    I mean what if we just don't want the user to give the operator or value and declare it by ourselves?????

  • @showme13100
    @showme13100 Год назад +1

    Dont we need to return the value of result or is it restricted in switch statement?

    • @programmingforbeginners7392
      @programmingforbeginners7392  Год назад +1

      We can return the value of result since it is declared under main function.. we just needed to print result so it was printed within main, but you can return it as well if using another function for switch case

    • @showme13100
      @showme13100 Год назад

      @@programmingforbeginners7392 thank you

  • @ilyosshoniyozov6012
    @ilyosshoniyozov6012 Год назад +3

    Bro you made a mistake which was in 4th operator. You have to put n2=0 System.out.println ("invalid");
    Or other things words like that

  • @meriemmansouri3441
    @meriemmansouri3441 Год назад +1

    Thank you so much 🙏

  • @Got_viral
    @Got_viral Год назад +3

    Thanks bro

  • @furkan809
    @furkan809 Год назад +1

    thank you

  • @RashmiRashmi-rw4ek
    @RashmiRashmi-rw4ek 3 месяца назад

    the code is showing that the operator is defined first and then again why the declaration is again required

  • @Idealbruda
    @Idealbruda 4 месяца назад

    Is it necessary to write result =0 , can't we just start from switch

  • @Jeremy-m8r
    @Jeremy-m8r 11 месяцев назад

    Can you tell me how to use multiple operators

  • @RashmiRashmi-rw4ek
    @RashmiRashmi-rw4ek 3 месяца назад

    where is the modulus operator??

  • @huyle5011
    @huyle5011 Год назад +1

    How to make operator as + - × /

    • @programmingforbeginners7392
      @programmingforbeginners7392  Год назад

      you can ask the user to provide input as one of these 4 operators as a string, and based on the operator and other 2 numbers, the calculations can be done

  • @kaiumalrafi1369
    @kaiumalrafi1369 Год назад +1

    thank you so much. it helps me a lot..

  • @SladeBuffet
    @SladeBuffet Год назад +1

    you should consider that you cannot divide by 0

    • @weewee3138
      @weewee3138 Год назад

      It’ll give a logical error

  • @hrushikeswarareddy251
    @hrushikeswarareddy251 11 месяцев назад +1

    how can the program should keep on executing automatically after onetime completion plz let me know

  • @hasthapurammonuninni9591
    @hasthapurammonuninni9591 Год назад +1

    bro how to give continuous input without running programe again and again

    • @programmingforbeginners7392
      @programmingforbeginners7392  Год назад +1

      Put the code inside loop to continuously use the calculator

    • @tamilathalainimirtamila9120
      @tamilathalainimirtamila9120 10 месяцев назад

      ​@@programmingforbeginners7392
      Bro when I given exit option on the time wise program was get exit other wise prog still running wht a loop i use

  • @selfsufficient1987
    @selfsufficient1987 Год назад +2

    If I choose division and entered two nos as 35 and 45 then it gives me result as 0
    Please explain

    • @programmingforbeginners7392
      @programmingforbeginners7392  Год назад +3

      35/45 gives us result as 0.77 usually but in the Java code we are taking both these numbers as integers and that's why the result of division operation is also integer in this case - 0.77 is taken as 0 in the result..
      Change the data type to double for both the inputs taken and you'll get the result as 0.77
      Hope this helps 👍

    • @mann_mann
      @mann_mann Год назад

      @@programmingforbeginners7392 i have tried but still it is not working properly and it did not print the correct value.

    • @programmingforbeginners7392
      @programmingforbeginners7392  Год назад

      can you please provide your code?

    • @shuraimzaid6726
      @shuraimzaid6726 Год назад

      Double and float data types can be used in switch statements

    • @shuraimzaid6726
      @shuraimzaid6726 Год назад

      ​@@programmingforbeginners7392not working

  • @azharalibalouch3766
    @azharalibalouch3766 Год назад +1

    wow