20251108143629.webp
Q

20251108143629.webp

Question paper (build 07.05.20.19)
1 of 1
Paper No: 6
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 Cake with the following information:
Cake
-maker.String
-price:int
+Cake()
+Cake(maker:String, price int)
+getMaker:String
+getPrice() int
+setPrice(price:int):void
Where:

⚫ Cake() - default constructor.
Cake(maker:String, price:int)-constructor, which sets
values to maker and price.
getMaker():String
return a string s, which is
obtained by converting the last character in maker to
uppercase format and the remaining characters in
maker to lowercase format.
⚫ getPrice():int-return price.
.setPrice(price:int):void-update price.
The program output might look something like:
Enter maker: fRanceCake
Enter price: 12
1. Test getMaker()
Do not format the result.
Enter maker: Vietnamcake
Enter price: 12
1. Test getMaker()
Chưa có bình luận nào.

Thông tin

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

Share this media

Back
Bên trên Bottom