Title: Prob Ko Sa Skul...
Description: sensya..
dY!pte - June 28, 2007 01:02 AM (GMT)
i dont know kung diin ko ni na forum ibutang... mods/admin move nyo lang kung di na dri bagay...
sin o dra sagad sa java...
pwede kapatudlo..
hehehehe...
simple lang man, himo lang program that will covert sg number na eenter to into words...
ex: if i will enter 50 dapat ang magwa fifty...
hehehehehe...
sensya gd kay wala gd ko hinalung ong sa programming...
salamat sa tanan...
qwikqwik - June 28, 2007 01:46 AM (GMT)
ano ang limit migo dy!pte? like hasta sng 50 ang pwede ma. input sng user?
kag ano ni ang interface ya?.. applet or dos environment lang?...
ari sample code migo dy!pte.. just save it as numbers.java or any filename you want but make sure nga ang name sa public class parehos.
:thumb:
| CODE |
import javax.swing.JOptionPane; public class numbers // should be the same with your file name. { // main method begins execution of Java application public static void main ( String argd[] ) { String strNumber, strWord; // string variables int intNumber; // integer variables //get number from user strNumber = JOptionPane.showInputDialog("Enter a number from 1 to 5."); // convert string to integer intNumber = Integer.parseInt(strNumber); // Determine the word value of the number entered. switch(intNumber) { case 1: strWord = "One"; break; // Finish processing case case 2: strWord = "Two"; break; // Finish processing case case 3: strWord = "Three"; break; // Finish processing case case 4: strWord = "Four"; break; // Finish processing case case 5: strWord = "Five"; break; // Finish processing case default: strWord = ""; }// end switch JOptionPane.showMessageDialog( null, "You entered number " + strWord, "The number in words", JOptionPane.PLAIN_MESSAGE); System.exit(0); // terminates application } // end method main } // end class numbers
|
dY!pte - June 29, 2007 12:53 AM (GMT)
dos evironment migo kwik kag asta sa number 99 lang...
tanx gd...
qwikqwik - June 29, 2007 03:14 AM (GMT)
copy na lng na ang code... kag add sa swicth until 99...
e.g....
| CODE |
switch(intNumber) { case 1: strWord = "One"; break; // Finish processing case case 2: strWord = "Two"; break; // Finish processing case case 3: strWord = "Three"; break; // Finish processing case
more case here...... until...
case 98: strWord = "Ninety Eight"; break; // Finish processing case case 99: strWord = "Ninety Nine"; break; // Finish processing case default: strWord = ""; }// end switch
|
chram - June 29, 2007 07:28 AM (GMT)
sagad sagad kay migo rhix ba!!toto dy!pte...hibalua mayu ang ginatudlo!!!
indi lang pagcopiha!!hahahha!!tun-i mayu mig ah!!
good luck! :thumb:
qwikqwik - June 29, 2007 01:19 PM (GMT)
hahahaahahha...
sakto ka gid migo chram...
ang importante intyendehon...
:palakan :palakan
dY!pte - July 6, 2007 12:28 AM (GMT)
gina intiendi kop gd gani migo...
jc creator pro gali ang gamit namon sa programming...
ambot ngaa daw nabudlayan gd ko ni ya man...
mga arrays man na ang ginawakal ni sir...
:D :D :D
raymie_v - September 7, 2007 04:54 AM (GMT)
Pwerte kalawig nga code ba.
Indi pwede kon ang logic nya amo ni:
1. check for first digit
zero = ""
1 = treat separately and use case code until 19
2 = "twenty"
3 = "thirty"
4 = and so on until 9 (ninety)
2. check for the second digit
zero = ""
1 = "one"
2 = "two"
3 = etc, etc until 9
combine the two words and output to screen
example:
Number input is 31.
Program checks for case of the first digit and find 3.
Program puts "thirty" into a static variable
Program checks for the case of the second digit and find 1.
Program puts "one" in another variable
Program combines values of variables into "thirty one"
Program displays output to screen
:)