BTC USD 81,635.1 Gold USD 4,344.18
Time now: Jun 1, 12:00 AM

Bantuan diperlukan...

Saya biasa dengan language C#.. tapi lebih kurang la dengan Java.. huhu..

Soalan no 1

Code:
public static string NumToWord(int number)
{
    if (number == 0)
        return "zero";

    if (number < 0)
        return "minus " + NumToWord(Math.Abs(number));

    string words = "";

    if ((number / 1000000) > 0)
    {
        words += NumToWord(number / 1000000) + " million ";
        number %= 1000000;
    **

    if ((number / 1000) > 0)
    {
        words += NumToWord(number / 1000) + " thousand ";
        number %= 1000;
    **

    if ((number / 100) > 0)
    {
        words += NumToWord(number / 100) + " hundred ";
        number %= 100;
    **

    if (number > 0)
    {
        if (words != "")
            words += "and ";

        var unitsMap = new[] { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen" **;
        var tensMap = new[] { "zero", "ten", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety" **;

        if (number < 20)
            words += unitsMap[number];
        else
        {
            words += tensMap[number / 10];
            if ((number % 10) > 0)
                words += "-" + unitsMap[number % 10];
        **
    **

    return words;
**

No 2 dan 3 saya tak sempat nak pikir.. Insyallah esok saya cuba....

Try dulu code nie yep...;)

Gud luck

ade 2 soalan je bro...:)cgrock:)cgrock:)cgrock
 
alamak bro sham. dah x boleh pm. bro kena clear some space.
 
java aku pun hancus, javascript bleh la nak goreng sket2...kasi masta2 lain tlg assist...
 
sy ade 2 soalan assimnt. sape boleh bantu. sy ngaku hanya 2 bulan blaja java(sambung blaja kt oum). x sempat nk pandai pun. x pernah blaja java....sesape sudi bantu bgtau lah ye. 10mac kena hantar.insyaallah ade saguhati pada yg sudi membantu......10q

soalan 1

Write a practical Java program that reads an integer between 0 and 99 and verbalizes it. For example, if the program is given 23 it would display "twenty three".

soalan 2

Design a currency Converter class whose object will handle conversion of three currencies (Dollar, Ringgit, Pound). A single object of the new currency Converter class you design here will handle all these three currencies. Instead of having specific conversion methods such as toDollar, toPound and so forth, the new currency Converter class supports one generic conversion method call exchange. The method has three arguments: fromCurrency, toCurrency and amount. The first two arguments are String and give the names of currencies. The third argument is the amount that need to be converted. For example, to convert RM250 to dollar, we write:

dollar = converter.exchange(‘ringgit”, “dollar”, 250.0);


To set the exchange rate for a currency, we use the setRate method. This method takes three arguments. The first two arguments are the currency names, and the third argument is the rate. For example, if the exchange rate for dollar is 3.4 Dollar to RM1, then we write:

converter.setRate(“dollar”, “ringgit”, 3.4);

In addition, the class also have the following method:

updateRate (“fromCurrency”, “toCurrency”, newRate) - The first two arguments are the currency names, and the third argument is the new exchange rate.


Finally, test your program by creating its object in the main() method. :((:((:((

Apesal la plak ada soalan sekolah kat sini, takkan assignment pun nak suruh orang buat jugak.Nasib baik ramai member CG ni yang baik hati.. tapi masalahnya pada yang tt la, kalau soalan mudah macam ni tak boleh nak setelkan sendiri, camna nak buat yang lebih advance. Programming ni bukan sastera yang boleh di hafal dan kopipaste.

saya tak tahu java, tapi sy tau soalan ni tersangat mudah dan tak lepas industrial punya standard pun.
 
Apesal la plak ada soalan sekolah kat sini, takkan assignment pun nak suruh orang buat jugak.Nasib baik ramai member CG ni yang baik hati.. tapi masalahnya pada yang tt la, kalau soalan mudah macam ni tak boleh nak setelkan sendiri, camna nak buat yang lebih advance. Programming ni bukan sastera yang boleh di hafal dan kopipaste.

saya tak tahu java, tapi sy tau soalan ni tersangat mudah dan tak lepas industrial punya standard pun.

kalau sy pandai. sy dh buat sendiri. sy skolah x tinggi bro...blaja pun merangkak2..:((:((
 
soalan 1 simple past tense je ni..cuma a bit tedious nak buat if else statement or switch case

soalan 2 ni lagi senang

first buat

double exchange(double fromCurrency, double toCurrency, double amount){
// arithmetic caluclation
return double value;
**

void setRate(double dollar, double ringgit, double exchangeRate){
// fill in code
**

void update(double fromCurrency, double toCurrency, double newRate){
//fill in code
**


void main(){
double test = exchange(12,12,12);
setRate(12,23,28);
update(6,23,33)

**
 
soalan 1 simple past tense je ni..cuma a bit tedious nak buat if else statement or switch case

soalan 2 ni lagi senang

first buat

double exchange(double fromCurrency, double toCurrency, double amount){
// arithmetic caluclation
return double value;
**

void setRate(double dollar, double ringgit, double exchangeRate){
// fill in code
**

void update(double fromCurrency, double toCurrency, double newRate){
//fill in code
**


void main(){
double test = exchange(12,12,12);
setRate(12,23,28);
update(6,23,33)

**

thanks bro....
 
kalau sy pandai. sy dh buat sendiri. sy skolah x tinggi bro...blaja pun merangkak2..:((:((

sebelum seseorang tu pandai, mereka semua adalah *****. Dan mereka semua tu merangkak untuk belajar. Sampai lah mereka tu boleh buat sendiri. kalau tak di pecahkan ruyung mana nak dapat sagunya.

p/s: saya pun belajar tak tinggi, tak pernah belajar programming pun kat sekolah, belajar sendiri daripada yahoo dan google. di mana ada kemahuan di situ ada jalan.nak jalan shortcut tanya orang, tapi bukan suruh orang buatkan sampai habis.. kalau macam tu kita tak belajar apa2. Apa pekdah bayar yuran sekolah mahal2 tapi tak dapat benefit dari situ. TT pegi balik tanya lecturer balik lagi bagus.
 
Back
Top
Log in Register