PRO192_-_PE02_-_SU_2024_2181.webp
G

PRO192_-_PE02_-_SU_2024_2181.webp

2. Test setQuantity
3. Test toString
2. Test setQuantity
3. Test toString
Enter TC (1, 2 or 3): 1
Enter TC (1, 2 or 3): 2
OUTPUT:
TIVI
Enter new quantity: - 12
Enter TC (1, 2 or 3): 3
2. Test setQuantity
3. Test toString
Enter TC (1, 2 or 3): 3
OUTPUT:TIVI,0,N/A
OUTPUT:TIVI,3,A
OUTPUT:0
2. Test setQuantity
3. Test toString
Question 2:
Question 2: (3 marks)
Define a Shape class and a Triangle class extending from Shape (i.e. Shape is an abstract class and it is a superclass; Triangle is a subclass) with the following information:
Shape Where:
3 of 4
Paper No: 1
-color:String
Shape(): default constructor to set color is 'Black'
+Shape()
Shape(color:String): parameterized constructor,which sets value to color
+Shape(color:String)+getColor():String
getColor():String - return the color.
+setColor(color:String):void
+calArea():double
setColor(color:String):void set the color of Shape.
calArea():double- the abstract method will be implemented in subclass
+calPerimeter():double
calaminaatamidouble the abateant mathadaul La
Close

+ 93%
Chưa có bình luận nào.

Thông tin

Category
PRO192
Thêm bởi
gentle_man
Ngày thêm
Lượt xem
5,237
Lượt bình luận
0
Rating
0.00 star(s) 0 đánh giá

Image metadata

Filename
PRO192_-_PE02_-_SU_2024_2181.webp
File size
165.9 KB
Dimensions
1920px x 859px

Share this media

Back
Bên trên Bottom