How to Create Calculator in Java NetBeans Full Tutorial

Поделиться
HTML-код
  • Опубликовано: 5 фев 2025
  • How to Create Calculator in Java NetBeans Full Tutorial, using If Statement'
    Join this channel to get access to codes, perks, and see more interesting videos. / @djoamen
    To support more videos from this channel, visit the Paypal link below.
    www.paypal.me/...
    Channel Members can Download the Java Calculator and modify it for their own personal use: Plus one other source code per month. Total - 2 Source codes Per Month, only:
    drive.google.c...
    To Become a Channel member click on the link below to JOIN:
    / @djoamen
    To see Java NetBeans Calculator Tutorial using the Switch Statement see link below. • Java NetBeans Tutorial...
    How to Create Calculator in Python - Full Tutorial: • How to Create Calculat...
    Create C++ Windows Forms application in Visual Studio 2017, See the details of the Forum below:
    social.msdn.mi...
    How to create Stock Management Systems in Python - Full Tutorial
    studio.youtube...
    How to Create Advanced Tic Tac Toe Game in Python
    www.youtube.co...
    How to Create an Advanced Excel Data Entry Form With Search Function using Userform
    www.youtube.co...
    How to Create Currency Converter with Foreign Exchange Rates in Python
    • Data Science Tutorial ...
    How to Create Currency Converter with Foreign Exchange Rates in Python
    • Data Science Tutorial ...
    How to Create a Piano Using Windows Forms Application in Visual C++ 2017
    • How to Create a Piano ...
    How to Create a C++ Calculator Using Windows Forms Application in Visual Studio 2017
    • How to Create a C++ Ca...
    Join this channel to get access to perks:
    / @djoamen

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

  • @donnaperyginathome
    @donnaperyginathome 5 лет назад +4

    Wow! All of the people asking for this code! It's so simple! Great job and explanation.

    • @DJOamen
      @DJOamen  5 лет назад +1

      That's correct, thank you 👍👍

  • @imanaffiq9016
    @imanaffiq9016 2 года назад +2

    this is good explanation than my lecturer. tq ya

    • @DJOamen
      @DJOamen  2 года назад

      All the best

  • @mcbisinho
    @mcbisinho 4 года назад +2

    Thank you from Brazil!

    • @DJOamen
      @DJOamen  4 года назад +1

      You are welcome!

  • @adaminfinity1733
    @adaminfinity1733 3 года назад +3

    you forgot to add a conditional statement inside the divide code to check if you divide by 0. You should have text that says "Can't divide by 0"

    • @DJOamen
      @DJOamen  3 года назад +1

      Well spotted Adam

  • @MrJACU555
    @MrJACU555 9 лет назад +2

    nice you just help me pass one of exams on university :D

    • @DJOamen
      @DJOamen  9 лет назад +1

      +EZIO Congratulations

    • @MrJACU555
      @MrJACU555 9 лет назад +1

      +DJ Oamen thank you

  • @khangdeng8286
    @khangdeng8286 5 лет назад +2

    thanks Sir for this valuable information, may God give you good health in order to keep helping more people and thanks once again

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

    Nicely explained.

  • @smokingcon643
    @smokingcon643 9 лет назад +8

    Great tutorial. Very well explained. I have a couple of problems - the division sign (/) gives inaccurate results. For example; 6/2 = 3, just fine; but 6/4 = 2, and the decimal doesn't work; 5.5 * 2 = 8. Otherwise very good and helpful. Thanks.

    • @DJOamen
      @DJOamen  9 лет назад +2

      +brodmontgomery Change the equals as follows: switch (operations)
      {
      case "+":
      //secondnum = Double.parseDouble(jtxtDisplay.getText());
      result = firstnum + secondnum;
      answer = String.format("%.2f", result);
      jtxtDisplay.setText(answer);
      break;
      case "-":
      //secondnum = Double.parseDouble(jtxtDisplay.getText());
      result = firstnum - secondnum;
      answer = String.format("%.2f", result);
      jtxtDisplay.setText(answer);
      break;
      case "*":
      //secondnum = Double.parseDouble(jtxtDisplay.getText());
      result = firstnum * secondnum;
      answer = String.format("%.2f", result);
      jtxtDisplay.setText(answer);
      break;
      case "/":
      //secondnum = Double.parseDouble(jtxtDisplay.getText());
      result = firstnum / secondnum;
      answer = String.format("%.2f", result);
      jtxtDisplay.setText(answer);
      break;
      case "%":
      //secondnum = Double.parseDouble(jtxtDisplay.getText());
      result = firstnum % secondnum;
      answer = String.format("%.2f", result);
      jtxtDisplay.setText(answer);
      break;
      }

    • @smokingcon643
      @smokingcon643 9 лет назад +1

      +DJ Oamen
      Thanks buddy, I get it now - I used ("%4.3f", result); to give me 4 digits total, with 3 after the decimal, and it works fine now.

    • @DJOamen
      @DJOamen  9 лет назад

      +brodmontgomery Well done.

  • @somerandomgirl527
    @somerandomgirl527 3 года назад +1

    Thanks so much for this 👏👏👏

    • @DJOamen
      @DJOamen  3 года назад

      You're so welcome!

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

    You are my savior! I'm pass deadline but thank you!!!!!!!!!!! XD

  • @JhonBenedictChannel
    @JhonBenedictChannel 5 лет назад +1

    Thanks for the Tutorial.

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

    Thnx alot really it's wonderful ❤

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

      Most welcome 😊

  • @aliciajohn5528
    @aliciajohn5528 2 года назад

    Thank you thank you soo much🥰🥰🥰

    • @DJOamen
      @DJOamen  2 года назад

      You’re welcome 😊

  • @onlyshorts2213
    @onlyshorts2213 2 года назад

    Thanku so much 😭😭😭😭😭😭😭🙏🙏🙏🙏

  • @ybmtechtips4895
    @ybmtechtips4895 3 года назад

    Wow😀 That's lit🔥😎

  • @danielogwal
    @danielogwal 3 года назад +2

    Thanks for the clear video explanation. Can you please add how to do with decimals

    • @DJOamen
      @DJOamen  3 года назад

      Yes, sure, the video you had a look at is an old one. Check out the link below, the tutorial include decimal and backspace.
      ruclips.net/video/Ym9_qF4iGHg/видео.html

  • @sanjingot6486
    @sanjingot6486 3 года назад

    Thanks. Very detailed.

    • @DJOamen
      @DJOamen  3 года назад +1

      Glad it was helpful!

  • @sagarsedai8617
    @sagarsedai8617 5 лет назад

    Good job .. Helped me alot..

  • @nehalnaik3922
    @nehalnaik3922 3 года назад

    thank You for Guidance

    • @DJOamen
      @DJOamen  3 года назад

      You're most welcome

  • @arghanovanr
    @arghanovanr 4 года назад

    thank you... this is my first succesfull project

    • @DJOamen
      @DJOamen  4 года назад

      You are most welcome

  • @drentahiri2303
    @drentahiri2303 4 года назад

    Thanks you just earned a sub

    • @DJOamen
      @DJOamen  4 года назад

      Thanks for the sub!

  • @oldisgold4286
    @oldisgold4286 5 лет назад

    sir i understand this clearly

  • @Rockstar-pu6yn
    @Rockstar-pu6yn 9 лет назад +1

    I LIKE THIS VIDEO THIS VIDEO TO MY HELPED AM VERY HAPPY

    • @DJOamen
      @DJOamen  9 лет назад

      +Muhammadshafir Kp Thank yu

    • @alexandrajohnsson3703
      @alexandrajohnsson3703 9 лет назад

      +DJ Oamen Mr Oamen, how can you write code that makes it impossible for you to insert multiple periods like so "...", which results in an error. Would you use a try/catch construct or another if statement in the '=' operator.

    • @DJOamen
      @DJOamen  9 лет назад +1

      I will public a new video to solve that problem sometime.

    • @alexandrajohnsson3703
      @alexandrajohnsson3703 9 лет назад +2

      Thanks so much! It would be awesome if you could also make the decimals only appear if there's actual decimal numbers. Do you know what I mean?

  • @manosgrimmjow434
    @manosgrimmjow434 8 лет назад +1

    Thank you very much!

    • @DJOamen
      @DJOamen  8 лет назад +1

      +Manos Grimmjow You're welcome

  • @ghulamahmed6420
    @ghulamahmed6420 6 лет назад

    Thanx sir, a lot of thanx.

  • @lanceversoza5732
    @lanceversoza5732 2 года назад

    i like ur vids

  • @kvnagendra5354
    @kvnagendra5354 6 лет назад +2

    This was osm

  • @TheAashish50
    @TheAashish50 8 лет назад

    At 16:24, when i run the project, it shows : "Calculations.Calculator " does not have a main method." Bt it doesn't give option to set the main method. What should i do? And plz could you send me the code for the "C" button??

    • @DJOamen
      @DJOamen  8 лет назад

      +Aashish Shrestha forward your email and the video name you want the code

    • @TheAashish50
      @TheAashish50 8 лет назад

      +DJ Oamen aashishbabu14 @gmail.com i want the code of this very tutorial :)

  • @OMARAB-s2v
    @OMARAB-s2v 4 года назад

    good job very helpful

    • @DJOamen
      @DJOamen  4 года назад

      Glad to hear that!

  • @imenddd253
    @imenddd253 3 года назад

    Thx , good job

    • @DJOamen
      @DJOamen  3 года назад

      Thank you too!

  • @muzammilmuzammil8098
    @muzammilmuzammil8098 4 года назад

    Thanks you so much. That's so important to me to improve my coding skills

    • @DJOamen
      @DJOamen  4 года назад

      Glad to hear that!

  • @rizqimauludin8500
    @rizqimauludin8500 9 лет назад

    Thanks bro it works for my college task !

    • @DJOamen
      @DJOamen  9 лет назад

      Rizqi Mauludin You're welcome

  • @marcleoden1908
    @marcleoden1908 8 лет назад +1

    thank you very much for the tutorial! this was happen to be our project. :D big thanks!

    • @DJOamen
      @DJOamen  8 лет назад

      +Marc Rabino You're welcome. Are you in university?

    • @marcleoden1908
      @marcleoden1908 8 лет назад +1

      +DJ Oamen yes I am in a State Univ. in the Philippines to be precise hehe.

  • @mustafairam3954
    @mustafairam3954 3 года назад +1

    Thats awesome but when I write jtxtDisplay it shows an error..please explain...im using Netbeans 12

    • @DJOamen
      @DJOamen  3 года назад

      Change the TextField variable name to jtxtDiplay.
      And why have you not subscribe to the channel Mustafa, go ahead and subscribe 👍

    • @widi6848
      @widi6848 2 года назад

      @@DJOamen thank u so much, sir

  • @dextersolomon2380
    @dextersolomon2380 4 года назад +1

    I watched this two years ago before I left programming and am back here to watch it again..thanks a lot
    Now my issue here is my C button,Its not working..what do I do now?

    • @DJOamen
      @DJOamen  4 года назад +2

      jbtnCbUtton.setText("0");
      or
      jbtnCbUtton.setText(null);
      or
      jbtnCbUtton.setText("");

    • @prproducer8
      @prproducer8 4 года назад

      jTextDisplay.setText("");
      (jTextDisplay = *your display variable name*)

  • @CURSE-yx8mg
    @CURSE-yx8mg 4 года назад

    Thank u so much

    • @DJOamen
      @DJOamen  4 года назад

      Most welcome 😊

  • @CURSE-yx8mg
    @CURSE-yx8mg 4 года назад

    Thanks

  • @oldisgold4286
    @oldisgold4286 5 лет назад

    Thanks a lot

    • @DJOamen
      @DJOamen  5 лет назад

      You're welcome

  • @sailaungseing5148
    @sailaungseing5148 4 года назад +1

    How can we work with Decimal Point?

  • @swatiozra5914
    @swatiozra5914 5 лет назад

    thank you so much.

  • @SyedAliMurtazaZaidi
    @SyedAliMurtazaZaidi 5 лет назад

    its working 🤗

  • @mohammedal-hassan1121
    @mohammedal-hassan1121 4 года назад

    Hello sir i really appreciate your video and i love it sir but sir there's one thing sir i can see it clearly please can you zoom it more than 18 thank you so much sir.

    • @DJOamen
      @DJOamen  4 года назад

      Ok next time

  • @ademmohammed7719
    @ademmohammed7719 8 лет назад

    its nice video ,but dot(.) is not working as proper as the real one. when you press it 2.2.2.3,but it should work like 2.2223 does not have to accept the dot oprand reptdly.

    • @DJOamen
      @DJOamen  8 лет назад

      +Adem mohammed You are not a subscriber, thumbs up and subscribe, if you want the code?

  • @amaniama8077
    @amaniama8077 2 года назад

    Thanx

  • @daemonkhun4108
    @daemonkhun4108 2 года назад

    What is the code in C button?

    • @DJOamen
      @DJOamen  2 года назад

      C is for Clear
      Check out the link below, is the latest calculator tutorial in Java
      ruclips.net/video/Ym9_qF4iGHg/видео.html

  • @franklinmbamalu9798
    @franklinmbamalu9798 3 года назад

    Pls give Me the steps in doing it because I am going to have a exam on how to create a calculator on netbeans

    • @DJOamen
      @DJOamen  3 года назад

      Watch the video

  • @SheilaRosin
    @SheilaRosin 9 лет назад

    do you have a tutorial for MDAS calculator for java netbeans?

    • @DJOamen
      @DJOamen  9 лет назад

      +Sheila Rosin Yes I do, see link below: Java NetBeans Arithmetic Operator of MDAS calculatorruclips.net/video/JWXOs3tzlpY/видео.html

    • @SheilaRosin
      @SheilaRosin 9 лет назад

      thanks :)

  • @norviesarmiento1839
    @norviesarmiento1839 5 лет назад

    ty for this vid

    • @DJOamen
      @DJOamen  5 лет назад

      Thank you 👍

  • @capelaxx
    @capelaxx 9 лет назад

    how you put the decimal button working? i insert 2.2+2.2 and it gives 4 not 4.4

    • @DJOamen
      @DJOamen  9 лет назад +3

      +Fábio Capelas Change as follows ("%.2f",result); See belowString answer;
      secondnum = Double.parseDouble(jtxtDisplay.getText());
      if (operations == "+")
      {
      result = firstnum + secondnum;
      answer = String.format("%.2f",result);
      jtxtDisplay.setText(answer);
      }
      else if (operations == "-")
      {
      result = firstnum - secondnum;
      answer = String.format("%.2f",result);
      jtxtDisplay.setText(answer);
      }
      else if (operations == "*")
      {
      result = firstnum * secondnum;
      answer = String.format("%.2f",result);
      jtxtDisplay.setText(answer);
      }
      else if (operations == "/")
      {
      result = firstnum / secondnum;
      answer = String.format("%.2f",result);
      jtxtDisplay.setText(answer);
      }
      else if (operations == "%")
      {
      result = firstnum % secondnum;
      answer = String.format("%.2f",result);
      jtxtDisplay.setText(answer);
      }

    • @jezzghumpz7064
      @jezzghumpz7064 9 лет назад

      +DJ Oamen make your int into double

  • @msann2060
    @msann2060 5 лет назад +1

    Thanks for sharing im doing my system right away

    • @DJOamen
      @DJOamen  5 лет назад

      That's how to learn, you made my day. Well done

  • @valerien6514
    @valerien6514 8 лет назад

    I don`t understand what this is means:
    answer=String.format("%.Of",result);
    Could you explain?

    • @DJOamen
      @DJOamen  8 лет назад

      +Валерія Нестерова ("%.Of") That is for zero decimal place. Try this out ("%.2f") and your answer will be two decimal place.

    • @valerien6514
      @valerien6514 8 лет назад

      +DJ Oamen, Thank you)))

    • @interestingy8484
      @interestingy8484 8 лет назад

      +DJ Oamen Wow, thanks for explaining this, although it didn't help me in the same way. I thought that "0f" was literally the word "Of," so I was getting unexplained errors.

  • @matheusmiliorini1482
    @matheusmiliorini1482 9 лет назад

    Thanks man! This video helped me a lot to understand more about Java GUI and stuff... I onluy have one question. What does "%.0f" means?

    • @DJOamen
      @DJOamen  9 лет назад

      +Matheus Miliorini It means zero decima place, you can change it to two decima place e.g "%.2f"

    • @DJOamen
      @DJOamen  9 лет назад

      +Matheus Miliorini sent

  • @sonaltomar9125
    @sonaltomar9125 2 года назад

    Hi , I am sonal
    I got a project from my school to make binary-decimal , octal-hex and vice versa conversion calculator, I am not getting anything how to do can you make a tutorial to help me plzz before 8th Jan 2023

    • @DJOamen
      @DJOamen  2 года назад +1

      See solution on the link below, and why are you not a subscriber. Good luck with your project.
      How to Create Scientific Calculator in Java NetBeans
      ruclips.net/video/OgtEwQWYkvo/видео.html

    • @sonaltomar9125
      @sonaltomar9125 2 года назад

      @@DJOamen I don't know about your channel last day only my friend suggested me your channel, so I have earlier not subscribed but now I am your subscriber 😊

    • @sonaltomar9125
      @sonaltomar9125 2 года назад

      @@DJOamen And thank you so much for your grateful help🙏

  • @erblinhetemi5551
    @erblinhetemi5551 2 года назад

    cannot find symbol : variable jtxtDisplay
    Can u help me

    • @DJOamen
      @DJOamen  2 года назад

      That's the variable name of the TextField

  • @hudahusein2871
    @hudahusein2871 5 лет назад

    thanks brother but where is clear button code plz

    • @DJOamen
      @DJOamen  5 лет назад

      You can reset the textbox to as follows:
      txtDisplay.clear
      or
      txtDisplay.Text=""
      or
      txtDisplay.Text="0"

  • @sarrabenabdallah3667
    @sarrabenabdallah3667 4 года назад

    Thank you so much that is so helpful ❤️

    • @DJOamen
      @DJOamen  4 года назад

      Glad it was helpful!

  • @HotHeadRiderBD
    @HotHeadRiderBD 6 лет назад

    Where is the part of jtxtDisplay???

    • @DJOamen
      @DJOamen  6 лет назад

      The JTextField is the jtxtDisplay

  • @thelockerroomstories
    @thelockerroomstories 4 года назад

    What is the use of becoming a member even if after becoming a member need to wait for the approval of the admin for the source code.... it is just a waste of time and money.....

    • @DJOamen
      @DJOamen  4 года назад

      Five project was sent to you this morning, although time zone may be a problem, but more than five project is very good. Check your email for all the files.

  • @tantanalano5163
    @tantanalano5163 3 года назад

    Why I can't get run the = sign, that only my problem huhu

  • @othabesttvdjcoleman218
    @othabesttvdjcoleman218 5 лет назад

    Mine it doesn't desplay the frame, it desplays the contents at the compiler

    • @DJOamen
      @DJOamen  5 лет назад

      Check your codes

  • @justincromberge6831
    @justincromberge6831 9 лет назад

    Easy tutorial, thanks!

    • @DJOamen
      @DJOamen  9 лет назад

      +Justin Cromberge Thanks

  • @crisreyes6288
    @crisreyes6288 9 лет назад

    Hi sir DJ can i have the codes for clearing the calculation which i C button thank you i already did all but the C button i dont know the codes :( thank you so much sirr!

    • @DJOamen
      @DJOamen  9 лет назад +1

      +Cris Reyes jtxtDisplay.setText(null);

    • @crisreyes6288
      @crisreyes6288 9 лет назад

      +DJ Oamen thank you sir i watch ur prev video and i found that codes thanks it helped me in my college project thank you so much you're awesome sir (y)

    • @crisreyes6288
      @crisreyes6288 9 лет назад

      +Cris Reyes sir can u check your piano video tutorial send me the notes sir thank you so much more power to you,

    • @DJOamen
      @DJOamen  9 лет назад

      Thanks for your kind words Cris. Can you forward your email to me for the Piano Notes/code and can you tell me which of the programming language piano you meant. (VB, Java, VBA, C ++, C#, Flash or Python?)

    • @crisreyes6288
      @crisreyes6288 9 лет назад

      +DJ Oamen crisantoreyes1059@gmail.com that's the email prog language is java netbeans thank you for you kind sir you video tutorial isn't hard to copy awesome morepower thank you again sir your hero (y)

  • @SilverNovaRS
    @SilverNovaRS 8 лет назад +1

    I have subscribed, could you please send me the source code?

    • @DJOamen
      @DJOamen  8 лет назад

      +SilverNova forward your email and the video name you wanted.

    • @theduke6109
      @theduke6109 8 лет назад

      +DJ Oamen Me too. Im gonna send you my email on Google +. Ok?

    • @SilverNovaRS
      @SilverNovaRS 8 лет назад

      +DJ Oamen My email is Zexillium@hotmail.com and video name is "How to Create Calculator in Java NetBeans"

  • @inyfurry7954
    @inyfurry7954 8 лет назад

    i have subscribed, and where the source code

    • @DJOamen
      @DJOamen  8 лет назад

      forward your email

  • @ankitaankita2451
    @ankitaankita2451 5 лет назад

    Thanks < 3

  • @jurrasiclp8332
    @jurrasiclp8332 8 лет назад

    divison with a comma isnt possible need help my friend

    • @DJOamen
      @DJOamen  8 лет назад

      There is nothing like division with a comma. Thumbs up and subscribe, if you want the code

  • @hazememad2674
    @hazememad2674 9 лет назад

    its not running for me

    • @DJOamen
      @DJOamen  9 лет назад

      +Hazem Emad If you want the codes, forward your email

  • @ma.vanessadahilig9010
    @ma.vanessadahilig9010 9 лет назад

    Hi ! good DAY ^_^
    Can you teach me how to make a grading system in netbeans sir?
    i just LOVE your video of NetbeansJava sir.
    Thank you sir ^_^

    • @DJOamen
      @DJOamen  9 лет назад

      +Vanessa Dahilig Do you mean an exam grading system?

  • @aynullahazimi5493
    @aynullahazimi5493 8 лет назад

    code plz !!!

    • @DJOamen
      @DJOamen  8 лет назад

      +Aynullah Azimi your email?

  • @luiscotinguiba1066
    @luiscotinguiba1066 8 лет назад

    bom video,tem o link de dowload da calculadora completa ??

    • @DJOamen
      @DJOamen  8 лет назад

      +Luis Cotinguiba You are not a subscriber, thumbs up and subscribe, if you want the code?
      Reply ·

  • @unsuccessfulfatshow
    @unsuccessfulfatshow 8 лет назад

    .

    • @DJOamen
      @DJOamen  8 лет назад

      +Mohammed Bangi You are not a subscriber, thumbs up and subscribe, if you want the code?