Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding a custom program made for a client #38

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions clubCard.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include <iostream>
#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;
}
78 changes: 78 additions & 0 deletions clubCard.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#include <iostream>
#include <iomanip>
#include <ctime>
#include <cmath>
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;
}
}
};