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()