Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I will paste two files, PlusMember.cpp , and PremiumMember.cpp . The CalculateYEarlyFee function in PremiumMember is inheriting from PlusMember. However, in PlusMember, the function calculates
I will paste two files, PlusMember.cpp and PremiumMember.cpp The CalculateYEarlyFee function in PremiumMember is inheriting from PlusMember. However, in PlusMember, the function calculates the yearly fee with a discount applied. In PremiumMember, I need it to calculate the yearly fee with the discount and savings applied, but I need it to calculate the savings perecentage from the original yearly fee price, not the price with the discount included. EXAMPLEif YearlyFee is discount is and savings is I need the of savings to be calculated from not the which is discount PlusMember.cpp: #include "PlusMember.h
using namespace std;
PlusMember::PlusMemberconst std::string& firstname, const std::string& lastname, const std::string& phone, double fee, double discount
: BasicMemberfirstname, lastname, phone, fee discountdiscount
Getters
double PlusMember::GetDiscount const
return discount;
Setters
void PlusMember::SetDiscountdouble discount
if discount
discount;
else
discount discount;
double PlusMember::CalculateYearlyFee const
double yearlyFee BasicMember::CalculateYearlyFee;
yearlyFee yearlyFee discount;
return yearlyFee;
void PlusMember::Displaystd::ostream& os const
const int nameWidth ;
const int phoneWidth ;
const int feeWidth ;
const int discountWidth ;
os std::setwnameWidth GetFirstName GetLastName
std::setwphoneWidth GetPhone
std::setwfeeWidth std::fixed std::setprecision GetFee
std::setwdiscountWidth std::fixed std::setprecision GetDiscount;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started