Showing posts with label 15/16 SEM 1 DCT1093. Show all posts
Showing posts with label 15/16 SEM 1 DCT1093. Show all posts

10/03/2015

DCT1083 OOP: Assignment 3


1
Design a class named Fan to represent a fan. The class contains:
  1. Three constants named SLOW, MEDIUM, and FAST with values 1, 2, and 3 to denote the fan speed.
  2. An int data field named speed that specifies the speed of the fan (default SLOW).
  3. A boolean data field named on that specifies whether the fan is on (default false).
  4. A double data field named radius that specifies the radius of the fan (default 5).
  5. A string data field named color that specifies the color of the fan (default blue).
  6. A no-arg constructor that creates a default fan.
  7. The accessor and mutator methods for all four data fields.
  8. A method named toString() that returns a string description for the fan. If the fan is on, the method returns the fan speed, color, and radius in one combined string. If the fan is not on, the method returns fan color and radius along with the string "fan is off" in one combined string.
Draw the UML diagram for the class. Implement the class. Write a test program that creates two Fan objects. Assign maximum speed, radius 10, color yellow, and turn it on to the first object. Assign medium speed, radius 5, color blue, and turn it off to the second object. Display the objects by invoking their toString method.



2) 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



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 for the class Point and class Circle.

Due date :  15/10/2015


9/16/2015

DCT1083 OOP: Makluman Assignment 2 dan Ujian 1

Assalamualaikum.
Tarikh hantar Assignment 2 adalah pada 23/9/2015.
Assignment 2 boleh di buat berkumpulan seperti Assignment 1.

Ujian 1 akan di buat pada 30/9/2015. Contoh Ujian 1 adalah seperti di bawah:-

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

I.    A computer includes both hardware and software. In general, hardware is the physical aspect of the computer that can be seen, and software is the invisible instructions that control the hardware and make it perform tasks.

II.    The machine language is a set of primitive instructions built into every computer.

III.    Assembly languages are English-like and easy to learn and program.

IV.    A compiler is used to translate the High-level languages (source program) into a machine language program.

V.    Java enables users to develop and deploy applications on the Internet for servers, desktop computers, and small hand-held devices.( T / F)

VI.    Java is one of language that support object oriented programming. ( T / F)

VII.    Object-oriented programming (OOP) is a popular programming approach that is replacing traditional procedural programming techniques. ( T / F)

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

IX.    System.out.println is one of the pre-defined methods in Java. ( T / F)

X.    The main method looks like this: ( T / F)
public static void main(String[] args) {
  // Statements;
}

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



No    Statements                       Description
I.        x = 1;                               i = i + 8
II.      int x = 1;                         Addition
III.    double radius;                 Declaring and Initializing
IV.    final int SIZE = 3;           Multiplication
V.      +                                     Assignment Statements
VI.     *                                    Keywords
VII.   Char, class, const          Preincrement
VIII.  i += 8                            Constants
IX.     ++counter                      Declaring Variables

3. Give a brief explanation for the following question.


I.    What is Programming? [2 marks]

II.    What is Debugging? [2 marks]

III.    What is the difference between a Constant and a Variable? [2 marks]

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

I.    DCIT
II.    DCIT   Students
III.    $matric
IV.    matric_number
V.    1stJAVAProgram


5. Show ‘Evaluation Tree’ for the following expressions: [4 marks]

I.    8 + 2 / 4
II.    6 * 2 + 3 % 2
III.    3 + 2 / 5 + -2 * 4
IV.    2 * (1 + -(3/4) / 2) * (2 - 6 % 3)

6. Evaluate the following Boolean expressions. The value for X,Y and Z are as follows:-
X=1;
Y=2;
Z=3;

I.    XII.    X<0 br="" nbsp="">III.    ((XIV.    ((XV.    ! (X7. Write a java fragment for the following problems.


0.    Write a for statement to print integer 1 to 20. [example]

int i;
For (i=1; i<=20; i++)
System.out.Println(i);


I.    Write a for statement to print integer 1 to 10. [3 marks]


II.    Write a while statement to print integer 1 to 10. [3 marks]


8.    Write a an algorithm and a java program that displays the following table:-
 (note that 1 kilogram is 2.2 pounds):
 [10 marks]
    Kilograms     Pounds   
    1                     2.2      
    3                    6.6      
    ...
    100                220   





8/19/2015

DCT1083 OOP: Assignment 2

A. You are required to provide:-

(i) Algorithm (Flowchart or  Pseudocode)  and
(ii) Java program for each of the following problems.


1.    Read 10 integers and find the total of positive number and negative number.

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


B. Write a method that computes the commission, using the following rate table . The header of the method is:

public static double computeCommission(double salesAmount)

Sales Amount                    Commission Rate
$0.01–$5,000                      8 percent
$5,000.01–$10,000            10 percent
$10,000.01 and above       12 percent

7/14/2015

DCT1093 OOP. Selamat Hari Raya. Maaf Zahir & Batin

/**
 * @(#)MaafRaya0_0.java
 */
 import java.util.Scanner;
public class MaafRaya0_0 {
  
    public static void main(String[] args) {
        String answer;
        boolean maaf=false;
        Scanner input = new Scanner(System.in);
        System.out.println("Selamat Menyambut Hari Raya");
        do {
            System.out.println("Mohon Maaf Zahir & batin : ya / tidak");
            answer = input.next();
            if (answer.equals("ya")){
                maaf=true;    }
        }while(maaf!=true);
       System.out.println("Terima Kasih kerana sudi maafkan kami, 0-0 ya. ");   
    }
}
 

6/23/2015

DCT1093 Object Oriented Programming

Pelajar Diploma Information Technology (DIT) akan mengambil subjek Object Oriented Programming (di sebut OOP).

Berikut adalah bahan-bahan pengajaran bagi subjek berkenaan:-

1) Perancangan Pengajaran

Sila klik di sini untuk ' Lesson Plan  '

 




2) Buku Rujukan 
Y. Daniel Liang, Introduction to Java™ Programming, Brief Version, 9 Edition. 2013. Pearson Education. Sila cari di perpustakaan TATIUC, pelajar boleh samada menggunakan edisi 9 atau edisi 8. 'Power point slide boleh di dapati dari link di sini.
Buku Rujukan (Edisi 8)





Buku Rujukan (Edisi 9)


4. Perisian
 
 Bagi membangunkan aplikasi java dalam pc masing-masing . Pelajar perlu melakukan 'installation' JDK (java development kit) dan mana-mana editor untuk java (seperti NetBeans, Eclipse, BlueJ ).


5. Contoh Penilaian
Quiz
Assignment
Test
Final Exam



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