PRO192_-_PE_-_SU_2024_-_s_8_2153.webp
Winry97

PRO192_-_PE_-_SU_2024_-_s_8_2153.webp

  • Media owner Winry97
  • Ngày thêm
1 of 1
Paper No: 8
Question 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-quantity:int
Tofu() - default constructor.
+Tofu()
+Tofu(maker:String, quantity:int)
Tofu(maker:String, quantity:int) constructor, which sets values to maker and quantity.
+getMaker():String
getMaker():String returns a string s, which is obtained by lowercase the first and last letters of the maker string.
+getQuantity():int
+setQuantity(quantity:int):void
getQuantity():int - return quantity.
setQuantity(quantity:int):void quantity=new quantity.
Do not format the result.
update
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()
Zoom
Close
+ 100%
Chưa có bình luận nào.

Thông tin

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

Image metadata

Filename
PRO192_-_PE_-_SU_2024_-_s_8_2153.webp
File size
217.6 KB
Dimensions
1920px x 991px

Share this media

Back
Bên trên Bottom