4/17/2018

BCS2233 OOP. Method.

By implementing functions (also called methods) in a program,  programmer reduces coding time and debugging time, thereby reducing the overall development time.
Consider the following Java program. Create and use method where necessary.


//program 1
import java.util.Scanner;
public class tambahNombor {
   
    public static void main(String[] args) {
               int N1,N2,hasiltambah;
               Scanner input= new Scanner(System.in);
               System.out.println("Sila masukkan dua nombor");
               N1= input.nextInt();
               N2= input.nextInt();
               hasiltambah=N1+N2;
               System.out.println("Hasil tambah dua nombor ialah "+hasiltambah);
              
               System.out.println("Sila masukkan dua nombor");
               N1= input.nextInt();
               N2= input.nextInt();
               hasiltambah=N1+N2;
               System.out.println("Hasil tambah dua nombor ialah "+hasiltambah);
              
               System.out.println("Sila masukkan dua nombor");
               N1= input.nextInt();
               N2= input.nextInt();
               hasiltambah=N1+N2;
               System.out.println("Hasil tambah dua nombor ialah "+hasiltambah);
              
               System.out.println("Sila masukkan dua nombor");
               N1= input.nextInt();
               N2= input.nextInt();
               hasiltambah=N1+N2;
               System.out.println("Hasil tambah dua nombor ialah "+hasiltambah);
              
    }
}
 

//program 2
import java.util.Scanner;
 public class sumInteger {
   
    public static void main(String[] args) {
               int N1,N2,sum,count;
               Scanner input = new Scanner(System.in);
   
               System.out.println("Sila masukkan dua nombor!");
               N1= input.nextInt();
               N2= input.nextInt();
               sum=0;
               for(count=N1;count<=N2;count++)
               {
                  sum=sum+count;
               }
        System.out.println("Hasil tambah "+N1+" hingga "+N2+" ialah " + sum);
   
   
        System.out.println("Sila masukkan dua nombor ");
               N1= input.nextInt();
               N2= input.nextInt();
               sum=0;
               for(count=N1;count<=N2;count++)
               {
                  sum=sum+count;
               }
        System.out.println("Hasil tambah "+N1+" hingga "+N2+" ialah " + sum);
       
       
        System.out.println("Sila masukkan dua nombor!");
               N1= input.nextInt();
               N2= input.nextInt();
               sum=0;
               for(count=N1;count<=N2;count++)
               {
                  sum=sum+count;
               }
        System.out.println("Hasil tambah "+N1+" hingga "+N2+" ialah " + sum);
      
    }
}




//program 3
import java.util.Scanner;
public class bmi {
   
    public static void main(String[] args) {
               double berat,tinggi,BMI;
               String status;
               Scanner input = new Scanner(System.in);
               System.out.println("Sila masukkan berat (KG) dan tinggi (Meter)");
               berat = input.nextDouble();
               tinggi = input.nextDouble();
               BMI=berat/(tinggi*tinggi);
              
               if(BMI<18 .5="" p="">
                    System.out.println("underweight");
               else if((BMI>=18.5)&&(BMI<=24.9))
                               System.out.println("healthy");
               else if((BMI>=25)&&(BMI<=29.9))
                               System.out.println("overweight");
               else if (BMI>=30)
                               System.out.println("obes");
              
              
               System.out.println("Sila masukkan berat (KG) dan tinggi (Meter)");
               berat = input.nextDouble();
               tinggi = input.nextDouble();
               BMI=berat/(tinggi*tinggi);
              
               if(BMI<18 .5="" p="">
                    System.out.println("underweight");
               else if((BMI>=18.5)&&(BMI<=24.9))
                               System.out.println("healthy");
               else if((BMI>=25)&&(BMI<=29.9))
                               System.out.println("overweight");
               else if (BMI>=30)
                               System.out.println("obes");
                              
                              
               System.out.println("Sila masukkan berat (KG) dan tinggi (Meter)");
               berat = input.nextDouble();
               tinggi = input.nextDouble();
               BMI=berat/(tinggi*tinggi);
              
               if(BMI<18 .5="" p="">
                    System.out.println("underweight");
               else if((BMI>=18.5)&&(BMI<=24.9))
                               System.out.println("healthy");
               else if((BMI>=25)&&(BMI<=29.9))
                               System.out.println("overweight");
               else if (BMI>=30)
                               System.out.println("obes");
    }
}



//program 4
import java.util.Scanner;
public class ulangPesanan {
   
    public static void main(String[] args) {
               Scanner input = new Scanner(System.in);
               String pesanan;
               int i,jumlahUlangan;
              
               System.out.println("Sila masukkan Pesanan :");
               pesanan = input.nextLine();
               System.out.println("Berapa kali nak ulang ? :");
               jumlahUlangan = input.nextInt();
       
        for (i=1;i<=jumlahUlangan;i++)
        {
           System.out.println(pesanan);
        }
     
      System.out.println("Sila masukkan Pesanan :");
               pesanan = input.nextLine();
               System.out.println("Berapa kali nak ulang ? :");
               jumlahUlangan = input.nextInt();
       
        for (i=1;i<=jumlahUlangan;i++)
        {
           System.out.println(pesanan);
        }
       
        System.out.println("Sila masukkan Pesanan :");
               pesanan = input.nextLine();
               System.out.println("Berapa kali nak ulang ? :");
               jumlahUlangan = input.nextInt();
       
        for (i=1;i<=jumlahUlangan;i++)
        {
           System.out.println(pesanan);
        }
     
       
    }
}


 



4/15/2018

DCT2023 DS & FP. Lab Linked Lists

1.  Write a program in C to insert a new node at the beginning of a Singly Linked List.
Test Data :
Input the number of nodes : 3
Input data for node 1 : 5
Input data for node 2 : 6
Input data for node 3 : 7
 

Expected Output :
 Data entered in the list :                                                                                  
 Data = 5                                                                                                    
 Data = 6                                                                                                    
 Data = 7
 

2. Write a program in C to create a singly linked list of n nodes and count the number of nodes. 
Test Data :
Input the number of nodes : 3
Input data for node 1 : 5
Input data for node 2 : 6
Input data for node 3 : 7
Expected Output :
 Data entered in the list are :                                                                              
 Data = 5                                                                                                    
 Data = 6                                                                                                    
 Data = 7                                                                                                    
                                                                                                             
 Total number of nodes = 3 
 

4/10/2018

BCS2233 OOP. Guess a Number.

1. Consider the following flowchart. Identify:-
1.1 Selection
1.2 Repitition


2. Write a Java Program based on  given flowchart. 



3/12/2018

BCS1013 Prob Solving & Comp Programming . Array. Exercise/ Lab 13/3/2018


1. Describe the difference in the meaning of int a[5]; and the meaning of a[4]. What is the meaning of the [5] and [4] in each case?

2. In the array declaration 
double score[5];
state the following.
a. The array name
b. The base type
c. The declared size of the array
d. The range of values that an index for this array can have
e. One of the indexed variables (or elements) of this array



x




4. Consider the following function definition:

void too2(int a[], int how_many)
{
   for (int index = 0; index < how_many; index++)
   a[index] = 2;
}

Which of the following are acceptable function calls?

int my_array[29];
too2(my_array, 29);
too2(my_array, 10);
too2(my_array, 55);
“Hey too2. Please, come over here.”
int your_array[100];
too2(your_array, 100);
too2(my_array[3], 29);

5. Write a function definition for a function called one_more, which has a formal parameter for an array of integers and increases the value of each array element by one. Add any other formal parameters that are needed.


6. Create an array that can hold ten integers, and get input from user. Display those values on the screen, and then prompt the user for an integer. Search through the array, and count the number of times the item is found.

3/06/2018

BCS 2233 OOP. Assignment 1

Question 1



Question 2


Due Date 20/3/2018


 WARNING AGAINST PLAGIARISM

ASSIGNMENTS ARE INDIVIDUAL TASKS AND NOT GROUP ACTIVITIES.
(UNLESS EXPLICITLY INDICATED AS GROUP ACTIVITIES)
Copying of text from other learners or from other sources (for instance the study
guide, prescribed material or directly from the internet) is not allowed – only brief quotations are allowed and then only if indicated as such.
 


Be warned: students who submit copied text will obtain a mark of zero for the assignment and disciplinary steps may be taken by the Faculty and/or University. It is also unacceptable to do somebody else’s work, to lend your work to them or to make your work available to them to copy – be careful and do not make your work available to anyone!

Cara download Installer windows 10 dalam format ISO

1. Jika anda bercadang untuk download windows 10 melalui website rasmi windows - pilihan untuk download dalam format ISO tidak di berikan.  ...