Saturday, November 17, 2012

Programming Competition

Assalamualaikum and Sawadhikhap..

For this entry I would like to share about mathematical programming contest. ACM-ICPC, Al-Khawarizmi, and Aturkreatif. Have you heard about it? Actually I just entered one of the competitions I mentioned before, it quite tough. Some of the questions given were clearly stated the objective but having a few conditions that need to follow were challenging.

Special thanks to my University for sponsored me and my friends to participate, lecturers who highly motivated us and my beloved friends. Although our team couldn’t managed to win the competition we have something to share with you guys for the future planning.

  1. Most of the participant who managed to solves many problems usually active in Top Coder. Do visit this website and become a part of that community.
  2. For the beginners who want to see the example and answer of the problem, you can always visit to this site. It contains past set of acm icpc problem.
  3. There is one reference book that commonly used to solve this problem. Programming Challenges: The Programming Contest TrainingManual.
  4. Next is to learn from our colleagues in other University.

I hope some of these tips can help you in the future competition. If you want to try in the pc square environment, I can configure it for you(just for my university). =P 

Tuesday, February 28, 2012

Encapsulation in Java

Today i will demonstrate how to use Encapsulation in Java.
EnCAPSULation = Capsule means it is data hiding.

It is 1 of 4 fundamental in OOP concept. The others are Inheritance, Polymorphism and Abstraction.
Google it to know more :)

In this tutorial we will create two java file
public class Customer {
    private String customerID;
    private String customerName;
    private String address;
    private int pinCode;
    public String getCustomerID() {
        return customerID;
    public void setCustomerID (String myCustomerID) {
        customerID = myCustomerID;

    public String getCustomerName(){
        return customerName;
    public void setCustomerName (String myCustomerName){
        customerName = myCustomerName;

    public String getAddress () {
        return address;
    public void setAddress(String myAddress) {
        address = myAddress;
    public int getPinCode(){
        return pinCode;
    public void setPinCode(int myPinCode){
        pinCode = myPinCode;
 public class EncapsulationTry{
    public static void main (String [] args){
    // Creating object of Customer Class
    Customer customer = new Customer();
    /* Calling setter methods for setting the values of instance variables */
    customer.setCustomerID ("0123");
    customer.setCustomerName ("MFZ");
    customer.setAddress ("Seremban,Negeri Sembilan, Malaysia");
    customer.setPinCode (70400);
    /* Calling getter methods for printing the values of instance variables */
    System.out.println ("Customer ID :" + " " + customer.getCustomerID());
    System.out.println ("Customer Name:" + " " +  customer.getCustomerName());
    System.out.println ("Customer Address:" + " " + customer.getAddress());
    System.out.println ("Customer Pin Code:" + " " + customer.getPinCode());

Then compile all the java file and run the EncapsulationTry.class
Analyse the result and code, InsyaAllah you can get the point. 


Tuesday, February 21, 2012 (Versi Linux)

Assalamualaikum ( Program JAVA pertama)

Java merupakan antara bahasa programming. Boleh digunakan dalam mana2 platform kerana menggunakan JVM.

Dalam tutorial ini, kita akan menggunakan sistem Linux Ubuntu 11.10 dan Text Editor. Dalam bahasa JAVA penggunaan huruf amat sensitif. Pastikan anda menaip dengan tepat.

Taip 'code' di bawah dalam Text Editor dan 'save' sebagai ''

public class Assalamualaikum {

public static void main (String [] args) {
System.out.println ("Assalamualaikum daripada Galaxy!!!");
Dalam tutorial ini, semua file akan di 'save' dalam '~/Desktop/Galaxy'

'Compile' dan 'run'
Mulakan terminal dan 'compile'

mfz@mfz-Galaxy:~/Desktop/galaxy$ javac
'Assalamualaikum.class' akan di'create'. '.class' yang mampu untuk di 'run' di mane2 platform.
Kemudian 'Run' program tersebuat dan anda akan dapat lihat hasilnya.

mfz@mfz-Galaxy:~/Desktop/galaxy$ java Assalamualaikum
Assalamualaikum daripada Galaxy!!!