10/05/2016

DCT1093 OOP. Makmal 6 okt 2016

1. Tuliskan program di bawah dan "run" beberapa kali menggunakan input yang betul (nilai integer) dan input yang salah (nilai selain integer).
Bagaimana untuk menghalang "run time error" dari berlaku?

import java.util.Scanner;
public class demoexceptionHandling {   
    public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    int N = input.nextInt();  
    System.out.println(N );
    }
    }


__________________________________________________________________
2. Bina Rajah UML

Draw UML diagram for the class Point and class Circle as described below.

 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.

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

9/26/2016

BCT1113 Computer Programming Semester 1 2016 2017

Assalamualaikum wbkt. 

My Name is Mohd Nazri and I am going to teach you (BMPM students) computer programming. Here are the lists of some materials that are going to be used during the semester.



2.Powerpoint Slides


Introduction to Algorithm (Flowchart and Pseudocode)


3. Lab Sheet



4. Source Code Editor
A source code editor is a text editor program designed specifically for editing source code of computer programs. The Bloodshed Software - Dev-C++ will be used. 
you may download the software using the following link.
and the guide for installations can be found here.



9/24/2016

DCT1093 Assignment 3

Updated on 26 September 2016.

Problem Description:
 (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.

The accessor and mutator methods for all three data fields.

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 a rectangle object with the width =10,  height =15 and color is "RED". Use the getArea() method to print the area of rectangle and getPerimeter() method to print the perimeter of a rectangle.


9/17/2016

DCT1093 OOP. LAB. Creating Object and Class


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

The accessor and mutator methods for all three data fields.

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

A method named getPerimeter() that returns the perimeter.

---------------------------------------------
half way


public class lab17sept2016 {
   
    public static void main(String[] args) {
    // cara bina objek
       
    Rectangle segi4    = new Rectangle();
    System.out.println(segi4.color);
    System.out.println(segi4.height);
    System.out.println(segi4.width);
   
    Rectangle segiempat    = new Rectangle(10,15);
    System.out.println(segiempat.color);
    System.out.println(segiempat.height);
    System.out.println(segiempat.width);
   
    }
}

class Rectangle{
double width=1;
double height=1;
String color="white";

//A no-arg constructor that creates a default rectangle.
Rectangle(){
}

//A constructor that creates a rectangle with the specified width and height
Rectangle(double newWidth, double newheight){
width = newWidth;
height = newheight;
}

//The accessor (get) and mutator(set) methods for all three data fields.
double getwidth(){
return width;
}

double getheight(){
return height;
}
String getcolor(){
return color;
}

void setwidth(double newWidth){
width =newWidth;
}

void setheight(double newheight){
height =newheight;
}
void setcolor(String newColor){
color = newColor;
}

double getArea(){
return (width * height)    ;
}
double getPerimeter(){
return (2*(width + height))    ;
}


}





2. (The Account class) Design a class named Account that contains:
An int data field named id for the account (default 0).

A double data field named balance for the account (default 0).

A double data field named annualInterestRate that stores the current interest rate (default 0).

A Date data field named dateCreated that stores the date when the account was created.

A no-arg constructor that creates a default account.

The accessor and mutator methods for id, balance, and annualInterestRate.

The accessor method for dateCreated.

A method named getMonthlyInterestRate() that returns the monthly interest rate.

A method named withDraw that withdraws a specified amount from the account.

A method named deposit that deposits a specified amount to the account.

Draw the UML diagram for the class. Implement the class. Write a test program that creates an Account object with an account ID of 1122, a balance of 20000, and an annual interest rate of 4.5%. Use the withdraw method to withdraw $2500, use the deposit method to deposit $3000, and print the balance, the monthly interest, and the date when this account was created.
--------------------------------------------------------------------------------------------------------------------
public class Test {
  public static void main (String[] args) {
    Account account = new Account(1122, 20000);
    Account.setAnnualInterestRate(4.5);
    
    account.withdraw(2500);
    account.deposit(3000);
    System.out.println("Balance is " + account.getBalance());
    System.out.println("Monthly interest is " +
    account.getMonthlyInterest());
    System.out.println("This account was created at " +
      account.getDateCreated());
  }
}

Class Account {

  // Implement the class here

}


8/20/2016

DCT1093 OOP : Assignment 2

1. Write a Java program based on the following flowchart:-








2. Please provide:-
(i) Algorithm (Flowchart or  Pseudocode) and
(ii) Java Program

for the following problems.


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.


Due Date : 8 / 9 / 2016

7/23/2016

DCT1093 OOP. Assignment 1

You are required to provide:-

(i) Algorithm (Flowchart or  Pseudocode)  for each the following problems.


1.      Write a program that prompts the user to enter the width and height of a rectangle and displays the perimeter and area. Here is a sample run:

Enter the width of a rectangle: 5.25
Enter the height of a rectangle:  9.26

The perimeter is 29.02
The area is 48.62


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

Input the amount of water used and calculate the net amount for a customer.

7/13/2016

DCT1093 OOP Contoh Quiz 1

Write an algorithm (pseudo code OR flowchart) and java program to input  the radius and length of a cylinder and computes its volume using the following formulas:

area = radius * radius * 3.14159
volume = area * length




Solution ( Java Program)

import java.util.Scanner;
public class lab1q1 {
   
    public static void main(String[] args) {
       
        // TODO, add your application code
         Scanner input = new Scanner(System.in);
        System.out.println("Please enter radius and length");
        double radius = input.nextDouble();
        double length = input.nextDouble();
        double area, volume;
        area = radius * radius * 3.14159;
        volume = area * length;
        System.out.println("Volume =");
        System.out.println(volume);
    }
}



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