Results 1 to 8 of 8
  1. #1
    LeNzKiE is offline Member
    Join Date
    Aug 2009
    Posts
    4
    Rep Power
    0

    Default plss help me using jcreator...

    im new using jcreator.. and i have a problem doing my project..... help me plsss...

    heres the question/problem...


    Create a program that allows the user to input a number and display the output in word format; (ranges from +1 to 1000, -1 to -1000)

    example input
    Enter a number: 111 -999

    Example output
    one hundred eleven
    negative nine hundred ninety nine

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Hello Lenzkie and welcome to the forum!

    I'm thinking that this is less of a JCreator problem and more of a beginning Java problem, and so I am moving this question to the New to Java forum.

    Regarding your question: please tell us what you have done so far and what specifically about the problem you are not sure of.

    Best of luck.

  3. #3
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    7

    Default

    Agreed, show us where you are stuck. What code do you have thus far?

  4. #4
    makpandian's Avatar
    makpandian is online now Senior Member
    Join Date
    Dec 2008
    Location
    Chennai
    Posts
    432
    Rep Power
    6

    Default

    Could you please post your old code here?
    Mak
    (Living @ Virtual World)

  5. #5
    LeNzKiE is offline Member
    Join Date
    Aug 2009
    Posts
    4
    Rep Power
    0

    Default ....

    /**
    * @(#)LeNzKiE.java
    *
    * LeNzKiE application
    *
    * @author
    * @version 1.00 2009/8/8
    */

    import java.io*;
    public class LeNzKiE {

    public static void main(String[] args)throws Exception {

    // TODO, add your application code

    BufferedReader input=new BufferedReader (new InputStreamReader(System.in));

    int num;

    System.out.println("Enter a number:");
    num=Integer.ParseInt(input.readLine());
    if (num==1)
    System.out.print("one");
    else if (num==2)
    System.out.print("2");
    }
    }




    this is the sample but i think its wrong.....
    kindly plss help me....

  6. #6
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by LeNzKiE View Post
    this is the sample but i think its wrong.....
    kindly plss help me....
    How is it wrong for you? In other words, what errors are being shown or problems are you running in to?

    Edit: think of using several arrays in your program that hold the number Strings.

    You will also need to analyze your input and "massage" it before assigning number strings.

    Think of the steps that you would need to do if you wanted to do this on paper without a computer and in fact write down each small step necessary, and this will help you come up with a computer algorithm that will work. it doesn't necessarily have to be the one best algorithm, but instead mainly has to work. The key is to put some thought into the process that I outlined above, and you will get a decent start on this.

    Best of luck.
    Last edited by Fubarable; 08-07-2009 at 06:44 PM.

  7. #7
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Here's an example of what I meant using arrays. This program lets the user enter a number from 1 to 7 and outputs the corresponding day of the week.

    Java Code:
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    
    public class NumberStrings {
       private static final String[] DAYS_OF_WEEK = {"Sunday", "Monday", "Tuesday",
          "Wednesday", "Thursday", "Friday", "Saturday"};
    
       public static void main(String[] args) throws NumberFormatException,
             IOException {
    
          BufferedReader input = new BufferedReader(
                new InputStreamReader(System.in));
          System.out
                .print("Please enter a number for the day of the week from 1 to 7: ");
    
          int number = Integer.parseInt(input.readLine());
    
          System.out.println("The number entered was: " + number
                + ", and the corresponding week day is: "
                + DAYS_OF_WEEK[number - 1]);
          
          if (input != null) {
             input.close();
          }
    
       }
    }

  8. #8
    LeNzKiE is offline Member
    Join Date
    Aug 2009
    Posts
    4
    Rep Power
    0

    Default again

    thanks for the idea Fudarable...

    help me again plsss...

    code:

    import java.io.*;
    public class a {

    public static void main(String[] args)throws Exception {
    BufferedReader input =new BufferedReader
    (new InputStreamReader(System.in));
    int num;
    System.out.print("Enter a number:");
    num=Integer.parseInt(input.readLine());
    if (num<0){
    System.out.print("Negative ");
    num=num*-1;}
    if(num==1)
    System.out.println("One");
    if(num==2)
    System.out.println("two");
    } }

    i need a shortcut to print a 1-1000 not using a 1by1 method ^_^....
    kidly plss help me...

Similar Threads

  1. jcreator
    By arshesander in forum New To Java
    Replies: 1
    Last Post: 08-03-2009, 11:31 AM
  2. Applet in JCreator
    By mgm2010 in forum JCreator
    Replies: 0
    Last Post: 03-02-2009, 02:30 PM
  3. help me plss
    By low224 in forum New To Java
    Replies: 13
    Last Post: 12-09-2008, 06:15 PM
  4. About using jcreator
    By yuchuang in forum JCreator
    Replies: 4
    Last Post: 11-29-2008, 08:29 PM
  5. jcreator
    By nikhil_solanki015 in forum JCreator
    Replies: 2
    Last Post: 10-28-2008, 07:04 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
  •