Results 1 to 8 of 8
Thread: plss help me using jcreator...
- 08-04-2009, 04:16 PM #1
Member
- Join Date
- Aug 2009
- Posts
- 4
- Rep Power
- 0
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
-
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.
- 08-04-2009, 06:50 PM #3
Agreed, show us where you are stuck. What code do you have thus far?
- 08-05-2009, 07:12 AM #4
Could you please post your old code here?
Mak
(Living @ Virtual World)
- 08-07-2009, 05:48 PM #5
Member
- Join Date
- Aug 2009
- Posts
- 4
- Rep Power
- 0
....
/**
* @(#)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....
-
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.
-
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(); } } }
- 08-12-2009, 02:04 AM #8
Member
- Join Date
- Aug 2009
- Posts
- 4
- Rep Power
- 0
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
-
jcreator
By arshesander in forum New To JavaReplies: 1Last Post: 08-03-2009, 11:31 AM -
Applet in JCreator
By mgm2010 in forum JCreatorReplies: 0Last Post: 03-02-2009, 02:30 PM -
help me plss
By low224 in forum New To JavaReplies: 13Last Post: 12-09-2008, 06:15 PM -
About using jcreator
By yuchuang in forum JCreatorReplies: 4Last Post: 11-29-2008, 08:29 PM -
jcreator
By nikhil_solanki015 in forum JCreatorReplies: 2Last Post: 10-28-2008, 07:04 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks