1/05/2015

DCT 1093 OOP : Pre Test 1

1.  Response to the following statements by circling either T (TRUE) or F (FALSE). [10M]

        I.            i)Without programs, a computer is an empty machine. ( T / F )
      II.          ii)  Java is NOT a high-level language. ( T / F )
    III.            iii)Java enables users to develop and deploy applications on the Internet for servers, desktop computers, and small hand-held devices.( T / F )
    IV.          iv)  Java is one of language that support object oriented programming. ( T / F )
      V.            v)Reserved words or keywords are words that have a specific meaning to the compiler and cannot be used for other purposes in the program. ( T / F )
    VI.          vi)  The main method looks like this: ( T / F )

public static void main(String[] args) {
  // Statements;
}

 
 





  VII.           vii)An identifier is a sequence of characters that consist of letters, digits, underscores (_), and dollar signs ($).( T / F )
VIII.            viii)An identifier must start with a letter, an underscore (_), or a dollar sign ($). It cannot start with a digit. ( T / F )
    IX.          ix)  Logic Errors Produces incorrect result. ( T / F )
      X.            x) Run Time Error is an error that occurs during the execution of a program. ( T / F )

2. Match the following Statement / Name to its description. [8M]



No
Statements

Description
        I.             
x = 1;

Increment
      II.             
int x = 1;

Addition
    III.             
double radius;

Declaring Variables
    IV.             
final int SIZE = 3;

Declaring and Initializing
      V.             
+

Assignment Statements
    VI.             
*

Remainder
  VII.             
%

Multiplication
VIII.             
++

Constants

3. Give a brief explanation for the following question. [10 M]


         I.            What is debugging? [2 marks]




       II.            What is the difference between a constant and a variable? [2 marks]


     III.            Explain sequence, selection and iteration as used in programming. [6 marks]

4. Which of the following are invalid identifiers, why? [10 marks]

                     I.            my
                   II.            my#address
                 III.            my_address
                 IV.            my  address
                   V.            JAVA

5. Show an evaluation tree for the following expressions: [6 marks]


                    I.            10 + 2 - 2
                  II.            3 + 3 * 3 % 2
                III.            3 + 2 / 5 +2 * 4

6. (Computing the volume of a cylinder) Write an algorithm and a Java program that reads in the radius and length of a cylinder and computes its volume using the following formulas: [20 marks]
   Area
= radius * radius * p
  volume
= area * length


7. (Finding the largest) Write an algorithm and a java  program that two integers and find the largest. [20 marks]

1. T,F,T,T,T,T,T,T,T,T
2.



3.
4.
5.
6.
7.
Question 7
Pseudocode
-----------
1.Input two integers (N1 and N2)
2.IF N1 bigger then N2 then
   output N1
   else
   Output N2


Flowchart
---------

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?

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