Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "model/motorvehicle.hpp"
- MotorVehicle::MotorVehicle(const int baseRentPrice, const std::string &id, const int engineDisplacement) :
- Vehicle(baseRentPrice, id),
- m_engineDisplacement(engineDisplacement)
- {}
- const int MotorVehicle::getBaseRentPrice() const
- {
- if(m_engineDisplacement < 1000)
- {
- return Vehicle::getBaseRentPrice();
- }
- else if(1000 <= m_engineDisplacement && m_engineDisplacement <= 2000)
- {
- return (0.0005 * m_engineDisplacement + 0.5) * Vehicle::getBaseRentPrice();
- }
- else
- {
- return 1.5 * Vehicle::getBaseRentPrice();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement