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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started