BTC USD 81,159.0 Gold USD 4,378.18
Time now: Jun 1, 12:00 AM

Bantuan diperlukan...

shamputra

Active Member
Messages
2,002
Joined
Jan 25, 2009
Messages
2,002
Reaction score
26
Points
30
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
 
Last edited:
soalan die susah lah? sye pun x sentuh java.xpe TT.nnt sye sentuh java balik ye.heheh
10 Mac ye? relaxxx...tt :) kite solved sama2 ok..tapi kalau xlepas tt carik org len lah..haha :)
 
soalan die susah lah? sye pun x sentuh java.xpe TT.nnt sye sentuh java balik ye.heheh
10 Mac ye? relaxxx...tt :) kite solved sama2 ok..tapi kalau xlepas tt carik org len lah..haha :)

:((:((:(( tgh blur sgt2....
 
Soalan kacang gile...tak perlu blajar Java smpi dua bulan pun. Blajar 2 minggu pun patut dah tau..
 
PHP:
public class CurrencyConverter {

	double dollars;
	double ringgit;
	double conversionRate;
	
	public CurrencyConverter()
	{
		dollars = 0;
		ringgit= 0;
		conversionRate = 0;
	**
	            
	public double getConversionRate()
	{	conversionRate = System.in.nextDouble();
		return conversionRate;
		
	**
	public void getDollarsAndConvert()
	{	while(dollars != -1)
		{	System.out.println("Dollar value (or -1 to quit):");
			dollars = System.in.nextDouble();
			ringgit = dollars * conversionRate;
			System.out.println(dollars + "dollars is equal to " + ringgit+ " ringgit.");
		**
	**
			
**

as for the main()..

PHP:
import java.util.Scanner;

public class Tester {

	/**
	 * @param 
	 */
	public static void main(String[] args) {
		// TODO
		Scanner in = new Scanner(System.in);

		
		CurrencyConverter CC = new CurrencyConverter();
		System.out.println("How many ringgit is one dollar?");
		
		CC.getConversionRate();
		CC.getDollarsAndConvert();
	
	**

**


cth yg aku terpk...yg lain ko try sendiri or ader otai2 len bleh sambung hahaha

goodluck bro..

p/s: tag utk JAVA takde aku pkai php...ader kaler2 smart hahaha
 
Last edited:
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. :((:((:((
Sorry tumpang tanya, soalan no 1 apa maksud dia.. maap la english tak habih belajar... huhuhu

Leh bagi contoh? soalan 2 dan 3 dah paham dah...
 
riak nampak:)):)):))
senang bg yg tahu..susah bg yg tak tahu:D:D
bantu le tuan..klu senang:)cgrock:)cgrock

thanks pada sudi yg membantu. sy keja bidang teknikal. so pengetahuan lebih pada teknikal. bab2 prgramming ni hancus...huhu
 
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
 
Back
Top
Log in Register