Question paper (build 07.05.20.19)
+getMaker():String
+getPrice(cint
+setPrice(price:int):void
The program output might look something like:
Enter maker: franceCake
Enter price: 12
1. Test getMaker()
2. Test setPrice()
Enter TC (1 or 2): 1
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.
Do not format the result.
Enter maker: Vietnamcake
Enter price: 12
1. Test getMaker()
2. Test setPrice()
Enter TC (1 or 2): 2
Ok
OUTPUT:
francecakE
Enter new price: 15
OUTPUT:
15
Question 2:
(3 marks) Write a class Coffee and a class SpecCoffee extending from Coffee (i.c. Coffee is a superclass
FUO and SpecCoffee is a subclass) with the following information:
Coffee
Where: