5/15/2015

BCS2233 OOP: Solution for Assignment3 (Q2 and Q3)

Jawapan untuk Assignment 3.

Soalan 2 a) 

class time {
double secs, mins, hours;
time(){
secs=0; mins=0; hours=0;
}
public void showdata(){
System.out.Println(“Saat =” +secs);
System.out.Println(“Minit =” +mins);
System.out.Println(“Jam =” +hours);
}

Soalan 2 b)  

class rectangle {
double height,length;
date(){
height=0; length=0;
}
public void showdata(){
System.out.Println(“Tinggi =” +height);
System.out.Println(“Panjang =” + length);


Soalan 3

class point {
int x,y;

point(){
x=0;y=0;

double area(){
return 0;
}

double distance(int x1 ,int y1, int x2, int y2) {
return Math.sqrt((x2-x1)*(x2-x1)-(y2-y1)*(y2-y1));
}

}

class circle extends point {
int radius;

double area() {
return (3.14 * (radius* radius));
}

}
UML diagram  for the class Point and class Circle



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