Java Program to convert number to words | Java Program

Поділитися
Вставка
  • Опубліковано 18 жов 2024
  • Java Program to convert number to words | Java Program
    I think i tried to explain it well enough, if you still have any problems comment or dm!
    #java #numbertowords #numberwords
    Thanks for watching our video.
    Do subscribe.❤💕
    Try solving on your own!
    Program : drive.google.c...
    Check our playlist : • Isc Java Programs
    If you need any help, isc, java, just something , dm me !
    / chandraguptaroy
    ____
    Camera : Samsung Galaxy M30
    Mic: Boya BYM1 - www.amazon.in/...
    Laptop :Acer Aspire 5 i7 10th Gen
    Tripod :Tygot Adjustable -www.amazon.in/...
    Audio recorder: play.google.co...
    Screen Recorder : obs studio
    VideoEditor :Adobe Suit
    Audio from :
    ncs ncsmusic.com/
    youtube audio library /Mirror Mirror - Diamond Ortiz
    Stock Videos /Photos (if used):
    Pexel :www.pexels.com/
    Pixabay : www.pexels.com/
    Videov : www.videvo.net/

КОМЕНТАРІ • 75

  • @shaileshvishwakarma8938
    @shaileshvishwakarma8938 3 роки тому +4

    Hey can u upload the code for thousand, ten thousand and lakh

    • @mdarshath18
      @mdarshath18 3 роки тому +2

      @@theeducationvalley ok say the formula for it for ten thousands

    • @theeducationvalley
      @theeducationvalley  3 роки тому +1

      @@mdarshath18 I'll solve and upload tutorial to this program soon, there are too many requests now. 👍

    • @theeducationvalley
      @theeducationvalley  3 роки тому +4

      Tutorial will be out soon!
      UPTO 5 Digits:
      import java.util.*;
      class Advance_Number2Words
      {
      public static void main(String args[])
      {
      Scanner in=new Scanner(System.in);
      System.out.println("Enter a Number till 5-digits
      ");
      int n=in.nextInt();


      String wrd=String.valueOf(n);
      int l=wrd.length(); //for length of number.

      String z="",zz="";
      int i=0,c=0,nn=0,nnn=0,zzc=0;

      for( i=l-1; i>=0;i--) //backward for loop iterating from unit place to thousand.
      {
      char cc=wrd.charAt(i);
      c=Integer.valueOf(String.valueOf(cc)); //current digit.

      if(i>0) //for combating double number words like thirteen, nineteen etc...
      {
      zz=wrd.substring(i-1,i+1); //substring extracts string from string(.substring(inclusive,exclusive))
      zzc=Integer.valueOf(zz); //contain last two digits eg. 1234 and c=3, so zzc=23
      }
      else
      {
      zzc=22;
      }
      //System.out.println(zzc);

      //Arrays//
      String uw[]={"","One","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten","Eleven","Twelve",
      "Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Ninteen"};
      String tw[]={"","Ten","Twenty","Thirty","Fourty","Fifty","Sixty","Seventy","Eighty","Ninety"};
      //Arrays//

      //nnn controls whether it's hunderd or thousand.
      //nn controls the number of digits converted and it resets on hundred/thousand.
      //z contains the word.
      if (nnn==2) //when it reaches
      {
      if(c!=0)
      {z="hundred "+z;}
      nn=0;
      }
      if (nnn==3)
      {
      z="thousand "+z;
      nn=0;
      }

      // Main
      if(zzc

    • @theeducationvalley
      @theeducationvalley  2 роки тому +1

      Here's the advanced code with thousand, lakh , crore etc... ua-cam.com/video/XgL5RvgsQKI/v-deo.html

  • @theeducationvalley
    @theeducationvalley  2 роки тому

    If you are curious to have perfect code, here it is: ua-cam.com/video/XgL5RvgsQKI/v-deo.html.
    Enjoy!

  • @chandraguptaroy
    @chandraguptaroy 4 роки тому +10

    0:00 :Ques
    0:20 :Intro
    0:40 :Starts
    1:20 :Input a Sentence
    1:52 :Check for 3 digit number
    2:48 :What's the first step
    2:59 :Unit Place
    3:19 :Tenth Place
    4:11 :Hundredths place
    4:53 :First step for printing
    5:39 :[ Leave the first place of array empty ]
    6:40 :Printing 1st Part [

  • @gautamjangir8927
    @gautamjangir8927 3 роки тому +2

    Best explanation in the entire youtube, Thanks bhaiya.

  • @chocolateicecream3169
    @chocolateicecream3169 Рік тому +1

    In else loop, can't we use the while loop ???? Rather than writing so many linesss??

    • @theeducationvalley
      @theeducationvalley  Рік тому

      There can be many ways of writing one program, you can leave your solution in the comments of you find a better one. : )

  • @abbddullahh
    @abbddullahh Рік тому

    Simplest explanantion, Thanks!

  • @venkateramanan1010
    @venkateramanan1010 2 роки тому +1

    that quote after introduction

  • @ashuzakir5474
    @ashuzakir5474 2 роки тому

    Really an Amazing talent but please improve the way of explaining and reduce the background music ...

  • @elrickmaniquis2191
    @elrickmaniquis2191 3 роки тому +1

    does this code also work for negative numbers?

  • @sukumarg7845
    @sukumarg7845 2 місяці тому

    what if in an dynamic input
    Inputs
    1.2456
    2.654
    3.22

  • @icjay1793
    @icjay1793 2 роки тому +1

    What process for up to 1million number to word?

  • @aryanjainjain76
    @aryanjainjain76 4 роки тому +2

    Sir can you build a vidio on inheritance using program

    • @theeducationvalley
      @theeducationvalley  4 роки тому

      Sure! I passed out this year..... i'm making video on all the programs that we did. Where have you all reached now? Inheritance ?

  • @mdarshath18
    @mdarshath18 3 роки тому +1

    Hey bro...I need your help what if I want to print number to string 0 - 99999

  • @satishversatile
    @satishversatile 3 роки тому +1

    Is it possible to execute in eclipse

    • @theeducationvalley
      @theeducationvalley  2 роки тому

      Yeah, it can be executed in any IDE. Search Google, how to do that...

  • @challtejokirankasyap10a13
    @challtejokirankasyap10a13 3 роки тому +1

    thank you & super

  • @anithanandy
    @anithanandy 3 роки тому +3

    211?

  • @vamsiraj6438
    @vamsiraj6438 Рік тому

    I think there is a mistake in code bro that is
    For 110 to 119 it prints one hundred one or two so on
    And 120,130.., it prints one hundred twenty zero, one hundred thirty zero..,

  • @ruthrakumark2656
    @ruthrakumark2656 2 роки тому +1

    super bro

  • @shuchisingh6189
    @shuchisingh6189 2 роки тому

    why in uw and tw first column is vacant, why is it so?

    • @theeducationvalley
      @theeducationvalley  2 роки тому +2

      It is to make the program simpler.
      Position of an array starts at 0
      When we leave the first column vacant.
      The word for 1 comes at the 1st position of the array.

    • @shuchisingh6189
      @shuchisingh6189 2 роки тому

      @@theeducationvalley thank you sir!
      Sir, i want to learn programming and coding, can you please suggest how should i prepare myself for all of this ? Can you suggest me pathways to follow for this . I have started coding in java , i have some basic knowledge in c and python but still i sucks at tech code questions. I have to prepare myself in coming 2 months . Can you help please?

  • @_francoise_
    @_francoise_ 3 роки тому +1

    Bad naming system, but good job!

  • @njmanawatao3930
    @njmanawatao3930 2 роки тому +1

    Can you type the code its super blurred

    • @theeducationvalley
      @theeducationvalley  2 роки тому

      Link is in description bro: drive.google.com/drive/u/0/mobile/folders/1I3ddclu9Svd9EbqENGaQhNcSWK301FtH?usp=sharing

  • @dhru2512
    @dhru2512 Рік тому

    Why is that music in background

  • @abdulawwal3149
    @abdulawwal3149 2 роки тому

    beautiful explanation

  • @dizzywizzy5217
    @dizzywizzy5217 Рік тому

    it gives 2 errors.
    1) if you enter digits like 100,200,300....
    2) if you enter digits which contain numbers one to twenty in them ex ; 412,519,213 etc....

    • @theeducationvalley
      @theeducationvalley  10 місяців тому

      Yeah, this program isn't completely right.
      To be exactly right. It will add too much complexity. I have made a new video which returns the right answer.
      But, I don't think it's good for school level exams.
      Let me know if you find a better and simple solution. : )

  • @dayanithig7194
    @dayanithig7194 Рік тому

    Tnx thala 🔥🔥

  • @sukhmeetkaur6929
    @sukhmeetkaur6929 2 роки тому +1

    Thanks 👍

  • @arnimavashishtha2271
    @arnimavashishtha2271 3 роки тому +1

    Thanks man it helped!

  • @IA-jh2cz
    @IA-jh2cz 3 роки тому +1

    Can you edit the code to cater for decimal numbers eg. $34557889.56

    • @sitanshubhugun8219
      @sitanshubhugun8219 2 роки тому +2

      @@theeducationvalley you have not done it yet

    • @theeducationvalley
      @theeducationvalley  2 роки тому

      What do you exactly want in that question? Does it need to print with dollars and cents? Give me an example

  • @aylishahsiddiqui9769
    @aylishahsiddiqui9769 3 роки тому +2

    Isi ko three four nine kaise print kare

  • @aygulismayilova8414
    @aygulismayilova8414 3 роки тому +1

    Thank you so much.

  • @trkcds7365
    @trkcds7365 3 роки тому +4

    This code doesnt translate the hundreds value well enough, if you put 100 + 1~19, it will display One Hundred One Ten Nine ( 119 )

    • @theeducationvalley
      @theeducationvalley  3 роки тому +2

      I'm sorry, Yes, there are problems in this code, a better version of this video is almost ready now.!

    • @sumanthsai2254
      @sumanthsai2254 3 роки тому +1

      Program that displays hundreds value ( 119) and 4 digit value
      public class NumToWords {
      public static String NumberToWords(int a) {
      int onesword,c,tensword,e,f,hundredsword,thousandsword;
      onesword=a%10;
      c=a/10;
      tensword=c%10;
      e=a/100;
      hundredsword=e%10;
      thousandsword = a/1000;
      String str = "";
      String[] ab = {"","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","ninteen"};
      String[] tntotwnty = {"","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","ninteen"};
      String[] tens = { "","ten","twenty","thirty","fourty","fifty","sixty","seventy","eighty","ninety"};
      String hund = " hundred ";
      String thousand =" thousand ";
      if(a999)
      if(hundredsword==0)
      str = ab[thousandsword]+thousand+ab[hundredsword]+tens[tensword]+" "+ab[onesword];
      else
      str = ab[thousandsword]+thousand+ab[hundredsword]+hund+tens[tensword]+" "+ab[onesword];
      return str;
      }
      public static void main(String[] args) {
      System.out.println("Enter any number upto 4 digits");
      Scanner s = new Scanner(System.in);
      int num = s.nextInt();
      System.out.println(NumberToWords(num));
      }
      }

    • @theeducationvalley
      @theeducationvalley  2 роки тому

      ua-cam.com/video/XgL5RvgsQKI/v-deo.html This code does not have that issue.

  • @graceabogadie3974
    @graceabogadie3974 3 роки тому +1

    Thanks😊

  • @rajrajesh1669
    @rajrajesh1669 Рік тому +1

    Wrong input, fu*koff, was very user friendly....

  • @amangurjar7627
    @amangurjar7627 3 роки тому +1

    what is your name bro

  • @chitty2701
    @chitty2701 2 роки тому +1

    Video was not clear

    • @theeducationvalley
      @theeducationvalley  2 роки тому

      I hope you find this better... ua-cam.com/video/XgL5RvgsQKI/v-deo.html

  • @babjisriram3059
    @babjisriram3059 3 роки тому

    try 19

  • @ctflover
    @ctflover 3 роки тому

    If we give in input 114 .
    It will print one hundred ten four.

    • @theeducationvalley
      @theeducationvalley  2 роки тому +1

      Yeah, this code was school level so there are some issure, check this one for correct output if curious: ua-cam.com/video/XgL5RvgsQKI/v-deo.html

    • @ctflover
      @ctflover 2 роки тому

      @@theeducationvalley nah did it myself 6 months ago

    • @venkatasundarm2913
      @venkatasundarm2913 2 роки тому

      School level and sys.out is “fu*koff” ?