Professional Documents
Culture Documents
FM-BINUS-AA-FPT-66/R5
COMP6175
Object Oriented Programming
Teknik Informatika
E3-COMP6175-DY02
Computer Science
Revisi 00
Revision 00
Soal
Case
Create a class with given data member: name, address, balance, and membertype and member
function: buy(int price) and topup(int value).
Create a class that matches the following requirements:
[Class Name]
MemberCard
[Data Member]
- name char[100]
- address char[100]
- balance long int
- membertype char[20]
[Member Function]
+ Setter and getter for all attributes
+ public void buy(int price)
Decrease the balance of the player based on the price and membertype.
If the players membertype is Regular, decrease the MemberCards balance based on
formula:
Decrease balance = price - price/10
If the players membertype is Vip, decrease the MemberCards balance based on formula:
Decrease balance = price - price*2/10
1 of 2
230215
FM-BINUS-AA-FPT-66/R5
If the players membertype is Vip, increase the MemberCards balance based on formula:
Increase balance = value + (value/1000)*40
Halaman : 2 dari 2
Page
2 of 2