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.


(

((