Question: A class named Rectangle is represent a rectangle. The class contains: Kelas Rectangle mewakili suatu segiempat tepat. Kelas mengandungi: Two double data fields named width
A class named Rectangle is represent a rectangle. The class contains:
Kelas Rectangle mewakili suatu segiempat tepat. Kelas mengandungi:
Two double data fields named width and height that specify the width and height of the rectangle.
Dua medan data double bernama width dan height yang menerangkan lebar dan tinggi segiempat tepat
A no-argument constructor that creates a rectangle.
Pembina tanpa pembolehubah yang menghasilkan segiempat tepat
A constructor with argument that creates a rectangle with the specified width and height. Pembina dengan pembolehubah yang menghasilkan segiempat tepat dengan lebar dan tinggi dinyatakan
A method named getArea() that returns the area of this rectangle.
Kaedah bernama getArea() yang memulangkan luas segiempat tepat.
A method named getPerimeter() that returns the perimeter.
Kaedah bernama getPerimeter() yang memulangkan ukurlilit.
A method named Display() that print the width and height
Kaedah bernama Display() yang mencetak lebar dan tinggi.
Assume the modifier for data and methods is public. Draw the UML diagram for the class Rectangle.
Anggap pengubah bagi data dan kaedah adalah public. Lukiskan gambarajah UML bagi kelas Rectangle.
[10marks/markah]
A class named Rectangle is represent a rectangle. The class contains:
Kelas Rectangle mewakili suatu segiempat tepat. Kelas mengandungi:
Two double data fields named width and height that specify the width and height of the rectangle.
Dua medan data double bernama width dan height yang menerangkan lebar dan tinggi segiempat tepat
A no-argument constructor that creates a rectangle.
Pembina tanpa pembolehubah yang menghasilkan segiempat tepat
A constructor with argument that creates a rectangle with the specified width and height. Pembina dengan pembolehubah yang menghasilkan segiempat tepat dengan lebar dan tinggi dinyatakan
A method named getArea() that returns the area of this rectangle.
Kaedah bernama getArea() yang memulangkan luas segiempat tepat.
A method named getPerimeter() that returns the perimeter.
Kaedah bernama getPerimeter() yang memulangkan ukurlilit.
A method named Display() that print the width and height
Kaedah bernama Display() yang mencetak lebar dan tinggi.
Assume the modifier for data and methods is public. Draw the UML diagram for the class Rectangle.
Anggap pengubah bagi data dan kaedah adalah public. Lukiskan gambarajah UML bagi kelas Rectangle.
[10marks/markah]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
