You are on page 1of 2

230215

FM-BINUS-AA-FPT-66/R5

Soal Tugas Mandiri


Assignment Case

COMP6175
Object Oriented Programming
Teknik Informatika

E3-COMP6175-DY02

Computer Science

Periode Berlaku Semester Genap 2014/2015


Valid on Even Semester Year 2014/2015

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

+ public void topup(int value)


Increase the balance of the MemberCard based on the value and membertype.
Halaman : 1 dari 2
Page

1 of 2

230215

FM-BINUS-AA-FPT-66/R5

If the players membertype is Regular, increase the MemberCards balance based on


formula:
Increase balance = value + (value/1000)*20

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

You might also like