diff --git a/clubCard.cpp b/clubCard.cpp new file mode 100644 index 0000000..15431c5 --- /dev/null +++ b/clubCard.cpp @@ -0,0 +1,22 @@ +#include +#include "clubCard.h" +using namespace std; + +int main(){ + clubCard mem1("Gryffindor", "2,West Church Road, Ottawa", 228); + mem1.setName("Harry"); + mem1.setID(28543); + mem1.setCreate(00.21); //January 21st + mem1.setEXP(06.21); //Period of 6 months + mem1.setFeeStatus(230); + + string month[12] = {"January", "February", "March", "April", "May", "June", "July", "August", "September","October", "November", "December"}; + mem1.printHolderDetails(); + cout << "Member Since: " << month[mem1.getCreate()] << endl; + cout << "Total Fees: " << mem1.getFee() << "$" << endl; + mem1.getFeeStatus(); + + cout << "Member Till: " << month[mem1.getEXP()] << endl; + + return 0; +} diff --git a/clubCard.h b/clubCard.h new file mode 100644 index 0000000..72275cf --- /dev/null +++ b/clubCard.h @@ -0,0 +1,78 @@ +#include +#include +#include +#include +using namespace std; + +int counter = 0; + +class clubCard { + private: //attributes related to clubs + string ClubName, ClubAddress; + int annualFee; + + private: //attributes related to card holders + string CardHolderName; + int CardID; + float DateofCreation, DateofExpiration; //integers are months and decimals are days + bool isFeePaid = false; + int remainFee = 0; + + public: + clubCard(string name, string addr, int fee){ + cout << "----------------------" << endl; + cout << setw(17) << "Club Details" << endl << endl; + cout << "Name: " << name << endl; + cout << "Address: " << addr << endl; + cout << "Entry Fee: " << fee << "$" << endl; + cout << "----------------------" << endl << endl; + + ClubName = name; + ClubAddress = addr; + annualFee = fee; + counter++; + } + + void setName(string name) { CardHolderName = name; } + + void setID(int id) { CardID = id; } + + void setCreate(int create) { DateofCreation = create; } + + void setEXP(int exp) { DateofExpiration = exp; } + + void setFeeStatus(int amnt) { //considering payment once + if(amnt == annualFee) { + isFeePaid = true; + } + remainFee -= amnt; + remainFee += annualFee; + } + + void printHolderDetails(){ + cout << "Holder Name: " << CardHolderName << endl; + cout << "Card ID: " << CardID << endl; + } + + int getCreate(){ return DateofCreation; } + + int getEXP(){ return DateofExpiration; } + + int getFee(){ //logics on fee + return annualFee; + } + + void getFeeStatus(){ + if(isFeePaid == true && remainFee == 0){ + cout << "Fee Status: Paid" << endl; + } + else if(isFeePaid == false && remainFee > 0) { + cout << "Fee Status: Pending" << endl; + cout << "Pending Amount: " << remainFee << "$" << endl; + } + else if(remainFee < 0){ + cout << "Fee Status: Paid" << endl; + cout << "Remaining Change: " << abs(remainFee) << "$" << endl; + } + } +};