⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hourlyclassification.cpp

📁 著名的uncle Bob的Agile software development的代码
💻 CPP
字号:
#include "HourlyClassification.h"#include "TimeCard.h"#include "PayCheck.h"HourlyClassification::~HourlyClassification(){}HourlyClassification::HourlyClassification(double hourlyRate)  :itsRate(hourlyRate){}void HourlyClassification::AddTimeCard(TimeCard* tc){  itsTimeCards[tc->GetDate()] = tc;}TimeCard* HourlyClassification::GetTimeCard(const Date& date){  return itsTimeCards[date];}double HourlyClassification::CalculatePay(Paycheck& pc) const{  double totalPay = 0;  Date payPeriodEndDate = pc.GetPayPeriodEndDate();  map<Date, TimeCard*>::const_iterator i;  for (i=itsTimeCards.begin(); i != itsTimeCards.end(); i++) {    TimeCard * tc = (*i).second;    if (Date::IsBetween(tc->GetDate(), pc.GetPayPeriodStartDate(), pc.GetPayPeriodEndDate()))      totalPay += CalculatePayForTimeCard(tc);  }  return totalPay;}double HourlyClassification::CalculatePayForTimeCard(TimeCard* tc) const{    double hours = tc->GetHours();    double overtime = max(0.0, hours - 8.0);    double straightTime = hours - overtime;    return straightTime * itsRate + overtime * itsRate * 1.5;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -