Answer to Question #222495 in C++ for Jaguar

Question #222495
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.
1
Expert's answer
2021-08-02T07:15:49-0400
//define all setters and getters
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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS