Results 1 to 3 of 3
  1. #1
    765891 is offline Member
    Join Date
    Jan 2013
    Location
    'Murica
    Posts
    25
    Rep Power
    0

    Post Need help writing the if statements, for a number to english converter (numbers <100)

    Need help writing the if statements, for a number to English converter for numbers less than 100?
    So would i need to have negative numbers such as negative hundred or thousand or million (as far as an int can hold (excluding floats))
    I haven't worked with arrays much
    Little confused on what to do...
    Java Code:
     import java.util.*;
     //import java utility package
     
     public class Program5
     {
         public static void main(String[] args )
        {
           Scanner in = new Scanner(System.in);
           String[] ones ={"Zero", " One", " Two", " Three", 
                              " Four", " Five",
                            " Six", " Seven", " Eight", " Nine"};
           String[] teens= {" Ten", " Eleven", " Twelve",
                             " Thirteen", " Fourteen", " Fifteen",
                             " Sixteen", " Seventeen", 
                             " Eighteen", " Nineteen"};
           String[] tens =  {"", "Ten", " Twenty", " Thirty", " Forty", " Fifty",
                              " Sixty", " Seventy", " Eighty"," Ninety"};
                              
           int num=0;
           
           System.out.println("Please enter a number less than 100");
           num=in.nextInt();
           if(num < 100)
           {
               
           }
           
        }
     }

  2. #2
    LetsG0Blue is offline Member
    Join Date
    Feb 2013
    Posts
    68
    Rep Power
    0

    Default Re: Need help writing the if statements, for a number to english converter (numbers <

    Are you trying to build a loop and end it with a 'if' statement? And are you trying to stay within 1-100?

  3. #3
    765891 is offline Member
    Join Date
    Jan 2013
    Location
    'Murica
    Posts
    25
    Rep Power
    0

    Default Re: Need help writing the if statements, for a number to english converter (numbers <

    Quote Originally Posted by LetsG0Blue View Post
    Are you trying to build a loop and end it with a 'if' statement? And are you trying to stay within 1-100?
    Yes (I might try 1-100 first) And i need help guiding to the display of the word version of the number

Similar Threads

  1. Number System Converter
    By SneakerIntel in forum New To Java
    Replies: 7
    Last Post: 02-07-2014, 08:15 PM
  2. Replies: 4
    Last Post: 06-13-2012, 06:21 AM
  3. Replies: 26
    Last Post: 11-14-2011, 03:22 PM
  4. Printing ranges of numbers using if/else statements
    By russbuss106 in forum New To Java
    Replies: 8
    Last Post: 03-05-2009, 06:03 AM
  5. trying to add up random numbers into one number
    By pjr5043 in forum New To Java
    Replies: 4
    Last Post: 09-15-2008, 03:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •