Consider the following class definitions and answer the questions that follow:
class Date {
public:
Date(int day, int month, int year);
int GetYear() const;
private:
int Day;
int Month;
int Year;
};
class Person{
public:
Person(const string &name, const string &address, const
Date &date);
string GetAddress() const;
string GetName() const;
private:
string Name;
string Address;
Date DateOfBirth;
};
class Customer{
public:
Customer(const string &name, const string &address,
int day, int month, int year,double creditlimit);
void IncreaseLimit(double amount);
string GetName() const;
string GetAddress() const;
void SetBalance(double balance);
double GetBalance() const;
private:
string Name;
string Address;
int DayOfBirth;
int MonthOfBirth;
int YearOfBirth;
double CreditLimit;
double BalanceDue;
};
(a) Provide an improved declaration for the Customer class that exploits the
principles of reusability. Provide the interface only.
string Customer::GetName() const {
return Name;
}
string Customer::GetAddress() const {
return Address;
}
void Customer::SetBalance(double balance){
BalanceDue = balance;
}
void Customer::IncreaseLimit(double amount){
CreditLimit += amount;
}
double Customer::GetBalance() const{
return Balance;
}
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Learn more about our help with Assignments:
C++