12/17/2014

DCT1093 OOP : Quiz 1 and Assignment 1

Quiz 1

Respond with the correct answer by marking either True “T” or False “F” for each question.
      I.        High-level languages include C, C++ and Java.                                        ( T / F )
    II.        The equation wages = rate x hours can be written in Java as:
wages = rate * hours;                                        ( T / F )
   III.        Algorithm  is a step-by-step problem-solving process.                                ( T / F )
  IV.        Comments are for the compiler, not the reader.                                         ( T / F )
    V.        There are two types of comments; Single line and multiple line.                ( T / F )
  VI.        Errors in syntax are found in compilation.                                                   ( T / F )
 VII.        Java  compiler guarantees that the program follows the rules of the language and does not guarantee that the program will run correctly.                                  ( T / F )
VIII.        Semantic rule: rules that specify which statements (instructions)
are legal.                                                                                                       ( T / F )
  IX.        Identifier (variable name) must begin with a number.                                ( T / F )
    X.        Java  is NOT case sensitive - NUMBER is the same as number.             ( T / F )
  XI.        bool type has two values: true and false.                                                     ( T / F )
 XII.        Java logical operators symbols  for NOT, AND and OR are  !, &&, ||.       ( T / F )
XIII.        Variable is a memory location whose content may change
during execution.                                                                                          ( T / F )
XIV.        All operations inside of () are evaluated last (Order of Precedence)          ( T / F )
XV.        Repetition allows you to efficiently use variables.                                       ( T / F )



[15 MARKS]





Assignment 1 

Sila download 'Assignment 1' anda di sini.

12/14/2014

BCS2233 OOP: Inheritance


Create a base class named Point consisting of x and y data members representing point coordinates. From this class, derive a class named Circle with another data member named radius. For this derived class, the x and y data members represent a circle’s centre coordinates. The member method of the Point class should consist of a constructor that set the value for x and y to 0, an area() method that return 0, and distance() method that returns the distance between two points, (x1,y1) and (x2,y2), where
Distance

Additionally, the derived class should has an overided method named area() that return’s a circle area

Area = 3.14 x radius2.

Draw UML diagram that for the class Point and class Circle.

12/13/2014

DCT1093 OOP: LAB WEEK 3


Identify the types of the following problems:-
(A=sequence Only, B=Selective,C=Iteration)

No
Problems
*Types (please Tick)
A
B
C
1
(Converting Fahrenheit to Celsius) Write a program that reads a Fahrenheit degree in double, then converts it to Celsius and displays the result in a message dialog box. The formula for the conversion is as follows:
celsius = (5/9) * (fahrenheit - 32)

 /


2
(Summing a series) Write a program to input a positive integer (n) and sum the following series:
1+2+3+….+n



 /
3
(Computing the volume of a cylinder) Write a program that reads in the radius and length of a cylinder and computes its volume using the following formulas:
   Area
= radius * radius * p
  volume
= area * length


 /


4
(Checking whether a number is even) Write a program that reads an integer and checks whether it is even. For example, if your input is 25, the output should be:
Is 25 an even number? False
If your input is 2000, the output should be:
Is 2000 an even number? true



 /

5
(Converting feet into meters) Write a program that reads a number in feet, converts it to meters, and displays the result. One foot is 0.305 meters.

 /


6
(Finding the highest score) Write a program that prompts the user to enter the number of students and each student's name and score, and finally displays the student with the highest score.

import java.util.Scanner;

public class labweek3grp2 {
   
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int N;
        System.out.println("Sila masukkan satu nilai");
        N= input.nextInt();
        if(N%2==0)
            System.out.println(N+"ialah nombor genap");
            else
        System.out.println(N+"ialah nombor ganjil");           
    }
}

 /
 /
7
(Calculating tips) Write a program that reads the subtotal and the gratuity rate, and computes the gratuity and total. For example, if the user enters 10 for subtotal and 15% for gratuity rate, the program displays $1.5 as gratuity and $11.5 as total.

 /


8
(Conversion from kilograms to pounds) Write a program that displays the following table (note that 1 kilogram is 2.2 pounds):
Kilograms Pounds
1         2.2
3         6.6
 
...
197       433.4
199       437.8



 /

9
(Finding the largest) Write a program that input two integers and find the largest.
import java.util.Scanner;

public class labweek3grp2 {
   
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int A,B;
        System.out.println("Sila masukkan dua nilai");
        A= input.nextInt();
        B= input.nextInt();
        if(A>B)
        System.out.println(A + " Paling besar");
            else
        System.out.println(B+ " Paling besar");           
    }
}

 /

10
(Finding the largest) Write a program that input three integers and find the largest.
import java.util.Scanner;

public class labweek3grp2 {
   
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int A,B,C,TBSR;
        System.out.println("Sila masukkan tiga nilai");
        A= input.nextInt();
        B= input.nextInt();
        C= input.nextInt();
        if(A>B)
        TBSR=A;
            else
        TBSR=B;
       
        if(C>TBSR)
        TBSR=C;
       
        System.out.println(TBSR+ " Paling besar");           
   
   
    }
}

 /

11
(Finding the largest) Write a program that input ten integers and find the largest.


 /
 /
12
 SATU Terengganu charges the following rates for its customer:-

Penggunaan
Caj
Minima (RM)
Kuantiti M3
(Meter Padu)
Caj
Setiap M3
0 - 20.00
RM0.42
RM4.00 sebulan
20.1 - 40.00
RM0.65
40.1 - 60.00
RM0.90
60.1 ke atas
RM1.00
.




12/08/2014

BCS3473 OOADD : Chapter 18 - Data Management Design

Chapter 18 - Data Management Design

Please download note (power point slide) here



Exercise

1.  What are criteria for a table design to be in:-
                          
                              i.    First Normal Form (1NF), how do you convert a normalized design to 1NF?
                            ii.    Second Normal Form (2NF), how do you convert 1NF design to 2NF design?
                           iii.    Third Normal Form (3NF), how do you convert 2NF design to 3NF design?

i.        A record is said to be in first normal form if it contains no repeating groups. To convert an unnormalized record you would expand the primary key of the record to include the key of the repeating group.

ii. To be in second normal form, a record must first be in first normal form and all fields that are not part of the primary key must be dependent on the entire primary key. To convert from 1NF to 2NF, you would create a new record for each field and a possible combination of the fields in the primary key. For each new record, designate one field or combination of fields as a primary key. Place the remaining fields with the primary key on which they depend. When finished placing the fields, discard any record that does not contain any additional fields other than its primary key. The remaining records are the 2NF of the original record.


iii. A record is in third normal form if it is in second normal form and if no nonkey field is dependent on another nonkey field. To convert a record to 3NF you would move the dependent field to a new record, which has the field it is dependent on as the primary key.


18.1  Give one example each of persistent object and transient object.
18.4 Outline the advantages and disadvantages of using a database management system over developing an application using files.
18.5 What is the key differences between a relational DBMS and object DBMS?

12/06/2014

BCS2233 OOP: Assignment 3

ASSIGNMENT 3

1. An object represents an entity in the real world and it has state, and behaviors. Define state and behaviour.

2. What is the difference between class and object.

3. What is the difference between overloading and over riding.

4. Define superclass and subclass.


2.  (The Rectangle class) Design a class named Rectangle to represent a rectangle. The class contains:
Two double data fields named width and height that specify the width and height of the rectangle. The default values are 1 for both width and height.

A string data field named color that specifies the color of a rectangle. Hypothetically, assume that all rectangles have the same color. The default color is white.

A no-arg constructor that creates a default rectangle.

A constructor that creates a rectangle with the specified width and height.

A method named getArea() that returns the area of this rectangle.

A method named getPerimeter() that returns the perimeter.

 Draw the UML diagram for the class. Implement the class. Write a test program that creates two Rectangle objects. Assign width 4 and height 40 to the first object and width 3.5 and height 35.9 to the second object. Assign color red to all Rectangle objects. Display the properties of both objects and find their areas and perimeters.

DCT1093 OOP : LAB 1

Question 2.1 
import java.util.Scanner;
public class ooplabweek1g2 {
   
    public static void main(String[] args) {
        double celsius;
        double fah;
        Scanner input = new Scanner(System.in);
        celsius = input.nextInt();
        fah = (9/5) * celsius + 32;
        System.out.println(fah);
    }
}


 Question 2.2

  import java.util.Scanner;
public class ooplabweek1q2 {
  
    public static void main(String[] args) {
      
        int radius, length;
        double area,volume;
        Scanner input = new Scanner(System.in);
        System.out.println("sila masukkan nilai jejari dan panjang silinder:");
        radius = input.nextInt();
        length = input.nextInt();
        area = radius*radius*3.14;
        volume = area * length;
        System.out.println("Isipadu silinder =:" + volume);
    }
}

12/03/2014

BCS3473 OOADD UML Diagram

Please visit the following sites for UML Diagram tutorials.

2. Lucidchart.com
3. Tutorialspoint.com

Some of the most important diagrams that students need to familiar with are as follows:-

I. Use case Diagram
II. Activity Diagram
III. Communication Diagram
IV. Class Diagram
V. Sequence Diagram

12/01/2014

BCS3473 OOADD Chapter 5:Modelling Concepts, 6: Requirenments Capture, 7: Requirements Analysis

Review Question


Chapter 5: Modelling Concepts

I. What is the different between a diagram and a model?
II. What are the four elements of a UML diagram?
III. Why do we use models in developing computerized information system and other artefacts?

Chapter 6: Requirenments Capture

I. Name the five main fact-finding techniques and list one advantages and one disadvantages of each.
II. What is the purpose of producing the use cases?
III. Describe in your own words the differences between the <> and <> relationships in use case diagrams.


Chapter 7: Requirements Analysis

I. Explain what is meant by 'use case realization'
II. Distinguish between attribute and value
III. Distinguish between link and association.
IV. What is multiplicity.

11/30/2014

BCS2233 OOP:Lab 1 Dis - 4 Dis 2014

Write  a java program for the following problems using object oriented approach. 

1.  Develop a program to input height and length of a right triangle and calculate and print the area of a right triangle.

        Area of right triangle = (height x length) /2


2. Write a java program to input three integers and print the smallest and largest.


3.  An electric supply company charges the following rates for its customers:-

No. of unit consumed                              Charges/unit (RM) 
1     - 200                                                           0.218 
201 - 300                                                           0.334                                                   
>= 301                                                               0.516

Read unit consumed and calculates the net amount of the bill for each consumer and print it.








BCS2233 Chapter 8: Classes and Objects

Write a java program using both  structured and Objected Oriented approach to input length and width of a rectangle and calculate its area and parameter.
-------------------------------------------------Structured------------------------------------------
import java.util.Scanner;
public class calculateAreadanPerimeterofBox {
    
    public static void main(String[] args) {
    Scanner input= new Scanner(System.in);
    System.out.println("Sila Masukkan nilai tinggi dan lebar segiempat!");
        int tinggi = input.nextInt();
        int lebar =input.nextInt();
        
        int luasSegiempat=tinggi*lebar;
        int perimeterSegiEmpat = 2*(tinggi+lebar);
        
          System.out.println("Tinggi : " +tinggi);
         System.out.println("Lebar : " +lebar);
        System.out.println("Luas Segi Empat=" +luasSegiempat );
        System.out.println("Perimeter Segi Empat=" +perimeterSegiEmpat );
  }
}

----------------------------------------------------------------------------------------------------------------


-------------------------------------------------Object Ortiented ------------------------------------------
import java.util.Scanner;
class segi4{
int luas,perimeter, lebar,tinggi;

void baca_data(){
Scanner input= new Scanner(System.in);
System.out.println("Sila masukkan lebar dan tinggi bagi suatu segi empat :");
lebar=input.nextInt();
tinggi=input.nextInt();
}

void kira_luas(){
luas = lebar * tinggi;
}

void kira_ukurlilit(){
perimeter=(lebar + tinggi)*2;

}

void pamir_data(){
System.out.println("lebar: "+lebar);
System.out.println("tinggi:"+tinggi);
System.out.println("luas:"+luas);
System.out.println("Ukur Lilit / Perimeter : "+perimeter);
}

}
 
public class demoClass_and_Object {
    
    public static void main(String[] args) {
   
    segi4 mys4 =new segi4();
        mys4.baca_data();
        mys4.kira_luas();
        mys4.kira_ukurlilit();
        mys4.pamir_data();

    
    }
}

----------------------------------------------------------------------------------------------------------------

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.  ...