PRO192_-_PE03_-_FA_2024_3202.webp
Sơn Tùng1

PRO192_-_PE03_-_FA_2024_3202.webp

+ setName(name: String): void
+ getName():String
+ setPrice(price: double): void
+ getPrice():double
+ toString(): String
setName(name: String): void set the
name to the name property
getName():String uppercase return the name in
setPrice(price: double): void-set the price to the price property
get Price():double - return the price
toString(): String - return the string format of the Product: id, name, price. The price is formatted with two decimal places. The name in uppercase
Write a class ProductList which extends from ArrayList (ArrayList is a collection) with the following information:
ProductList
Where:
+getProductById (id:int): Product
getProductById(id: int): Product -Find the product by id. If found then return product object, otherwise return a null value
+getProductWithMinPrice(): Product
getProductWithMinPrice(): Product return the product with the smallest price
Hints: to declare the ProductList class, you can use the following statement:
public class ProductList extends ArrayList<Product> {
}
The program output might look something like this (using the ProductList class):
The products have added:
The products have added:
The products have added:
Zoom
+ 100%
Close
Chưa có bình luận nào.

Thông tin

Category
PRO192
Thêm bởi
Sơn Tùng1
Ngày thêm
Lượt xem
3,158
Lượt bình luận
0
Rating
0.00 star(s) 0 đánh giá

Image metadata

Filename
PRO192_-_PE03_-_FA_2024_3202.webp
File size
259.7 KB
Dimensions
1920px x 990px

Share this media

Back
Bên trên Bottom