void setPriceCode(int arg);
virtual double getCharge(int daysRented);
};
#endif // PRICE_H
#ifndef PRICE_H
#define PRICE_H
class Price
{
public:
Price();
private:
int _priceCode;
public:
int getPriceCode();
void setPriceCode(int arg);
virtual double getCharge(int daysRented);
};
#endif // PRICE_H
price.cpp
[html]
#include
#include "price.h"
Price::Price()
{
qDebug()<<"construct Price";
_priceCode = 0;
}
int Price::getPriceCode()
{
qDebug()<<_priceCode;
return _priceCode;
}
void Price::setPriceCode(int arg)
{
_priceCode = arg;
}
double Price::getCharge(int daysRented)
{
qDebug()<<"Price::getCharge";
return daysRented;
}
#include
#include "price.h"
Price::Price()
{
qDebug()<<"construct Price";
_priceCode = 0;
}
int Price::getPriceCode()
{
qDebug()<<_priceCode;
return _priceCode;
}
void Price::setPriceCode(int arg)
{
_priceCode = arg;
}
double Price::getCharge(int daysRented)
{
qDebug()<<"Price::getCharge";
return daysRented;
}
regularprice.h
[html]
#ifndef REGULARPRICE_H
#define REGULARPRICE_H
#include "price.h"
class RegularPrice : public Price
{
public:
RegularPrice();
public:
double getCharge(int daysRented);
};
#endif // REGULARPRICE_H
#ifndef REGULARPRICE_H
#define REGULARPRICE_H
#include "price.h"
class RegularPrice : public Price
{
public:
RegularPrice();
public:
double getCharge(int daysRented);
};
#endif // REGULARPRICE_H
regularprice.cpp
[html]
#include
#include "regularprice.h"
RegularPrice::RegularPrice()
{
qDebug()<<"construct RegularPrice";
}
double RegularPrice::getCharge(int daysRented)
{
qDebug()<<"RegularPrice::getCharge";
double result = 2;
if(daysRented>2)
{
result += (daysRented-2)*1.5;
}
return result;
}
#include
#include "regularprice.h"
RegularPrice::RegularPrice()
{
qDebug()<<"construct RegularPrice";
}
double RegularPrice::getCharge(int daysRented)
{
qDebug()<<"RegularPrice::getCharge";
double result = 2;
if(daysRented>2)
{
result += (daysRented-2)*1.5;
}
return result;
}
newreleaseprice.h
[html]
#ifndef NEWRELEASEPRICE_H
#define NEWRELEASEPRICE_H
#include "price.h"
class NewReleasePrice : public Price
{
public:
NewReleasePrice();
public:
double getCharge(int daysRented);
};
#endif // NEWRELEASEPRICE_H
#ifndef NEWRELEASEPRICE_H
#define NEWRELEASEPRICE_H
#include "price.h"
class NewReleasePrice : public Price
{
public:
NewReleasePrice();
public:
double getCharge(int daysRented);
};
#endif // NEWRELEASEPRICE_H
newreleaseprice.cpp
[html]
#include
#include "newreleaseprice.h"
NewReleasePrice::NewReleasePrice()
{
qDebug()<<"construct NewReleasePrice";
}
double NewReleasePrice::getCharge(int daysRented)
{
qDebug()<<"NewReleasePrice::getCharge";
return daysRented*3;;
}
#include
#include "newreleaseprice.h"
NewReleasePrice::NewReleasePrice()
{
qDebug()<<"construct NewReleasePrice";
}
double NewReleasePrice::getCharge(int daysRented)
{
qDebug()<<"NewReleasePrice::getCharge";
return daysRented*3;;
}
discountprice.h
[html]
#ifndef DISCOUNTPRICE_H
#define DISCOUNTPRICE_H
#include "price.h"
class DiscountPrice : public Price
{
public:
DiscountPrice();
public:
double getCharge(int daysRented);
};
#endif // DISCOUNTPRICE_H
#ifndef DISCOUNTPRICE_H
#define DISCOUNTPRICE_H
#include "price.h"
class DiscountPrice : public Price
{
public:
DiscountPrice();
public:
double getCharge(int daysRented);
};
#endif // DISCOUNTPRICE_H
discountprice.cpp
[html]
#include
#include "discountprice.h"
DiscountP