LoyaltyScheme.cpp
上传用户:sz0451
上传日期:2022-07-29
资源大小:256k
文件大小:1k
- #include "stdafx.h"
- #include "LoyaltyScheme.h"
- #using <mscorlib.dll>
- using namespace System;
- LoyaltyScheme::LoyaltyScheme()
- {
- Console::WriteLine("Congratulations, you now qualify for bonus points");
- totalPoints = 0;
- }
- LoyaltyScheme::~LoyaltyScheme(void)
- {
- Console::WriteLine("Loyalty scheme now closed");
- }
- void LoyaltyScheme::EarnPointsOnAmount(double amountSpent)
- {
- int points = (int)(amountSpent / 10);
- totalPoints += points;
- Console::Write("New bonus points earned: ");
- Console::WriteLine(points);
- }
- void LoyaltyScheme::RedeemPoints(int points)
- {
- if (points <= totalPoints)
- {
- totalPoints -= points;
- }
- else
- {
- totalPoints = 0;
- }
- }
- int LoyaltyScheme::GetPoints()
- {
- return totalPoints;
- }