Advertisement
Guest User

Untitled

a guest
Nov 14th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. #include "model/motorvehicle.hpp"
  2.  
  3. MotorVehicle::MotorVehicle(const int baseRentPrice, const std::string &id, const int engineDisplacement) :
  4.         Vehicle(baseRentPrice, id),
  5.         m_engineDisplacement(engineDisplacement)
  6.  
  7. {}
  8.  
  9. const int MotorVehicle::getBaseRentPrice() const
  10. {
  11.     if(m_engineDisplacement < 1000)
  12.     {
  13.         return Vehicle::getBaseRentPrice();
  14.     }
  15.     else if(1000 <= m_engineDisplacement && m_engineDisplacement <= 2000)
  16.     {
  17.         return (0.0005 * m_engineDisplacement + 0.5) * Vehicle::getBaseRentPrice();
  18.     }
  19.     else
  20.     {
  21.         return 1.5 * Vehicle::getBaseRentPrice();
  22.  
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement