Programming language  

Posted by montel

aku memang dah lama nak master salah satu programming language , cari C , Java, VB.

so, aku dah try C, bolehlah..nak cari makan tu tak lah bolhe, tapi setakat nak faham tu, rasanya boleh kot.

ni nak try java pulak. aku tgk concept sama je , ngan c++ , object oriented ni

so, kena ada class dan object. apa benda tu? kena buat , baru faham


---------------my first java program------
import java.awt.*;
import javax.swing.*;
import java.util.*;
public class CubaanPertama

{
public static void main(String args[])
{
Scanner input = new Scanner(System.in);

System.out.print("Enter the initial deposit amount: ");
double depositAmount = input.nextDouble();

System.out.print("Enter annual percentage yield: ");
double annualInterestRate = input.nextDouble();

System.out.print("Enter maturity period (number of months): ");
int numberofMonths = input.nextInt();

System.out.println("\nMonth CD Value");

double newAmount = depositAmount;

//Loop ni sangat penting..
for (int i = 1; i <=numberofMonths; i++)
{
double interestBuilt = (newAmount * annualInterestRate) / 1200.0;
double newCDValue = newAmount + interestBuilt;
newCDValue = (int) (newCDValue * 100) / 100.0;
System.out.println(i + " " + newCDValue);
newAmount = newCDValue;
}


}
}

----------------end code...jalan ni..............

javac CubaanPertama.java
java CubaanPertama

This entry was posted on Monday, July 06, 2009 at Monday, July 06, 2009 . You can follow any responses to this entry through the comments feed .

0 comments

Post a Comment