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

No comments:

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