PRO192_-_PE_-_SU_2024_-_s_1_2167.webp
Thúy Nga1

PRO192_-_PE_-_SU_2024_-_s_1_2167.webp

uestion 1:
(2 marks) Read PE instructions at the bottom of the exam paper.
Do not pay attention to real meaning of objects, variables and their values in the questions below.
Write a class named Tofu with the following information:
Tofu
Where:
-maker:String
Tofu() - default constructor.
-quantity:int
Tofu(maker:String, quantity:int) constructor, which sets values to maker and quantity.
+Tofu()
+Tofu(maker:String, quantity:int)
+getMaker():String
getMaker():String returns a string s, which is obtained by lowercase the first and last letters of the maker string.
+getQuantity():int
getQuantity():int - return quantity.
+setQuantity(quantity:int):void
setQuantity(quantity:int):void quantity new quantity.
update
Do not format the result.
The program output might look something like:
Enter maker: TofU
Enter maker: tofu
Enter quantity: 2
Enter quantity: 2
1. Test getMaker()
1. Test getMaker()
2. Test setQuantity()
2. Test setQuantity()
Enter TC (1 or 2): 1
Enter TC (1 or 2): 2
OUTPUT:tofu
Enter new quantity: 10
OUTPUT:10
< Zoom
90%
>
Close
Chưa có bình luận nào.

Thông tin

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

Image metadata

Filename
PRO192_-_PE_-_SU_2024_-_s_1_2167.webp
File size
170.4 KB
Dimensions
916px x 988px

Share this media

Back
Bên trên Bottom