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

📄 technician.cpp

📁 一个工资计算的例子
💻 CPP
字号:
// Technician.cpp: implementation of the Technician class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "Myhomework.h"
#include "Technician.h"
#include "MyhomeworkDlg.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

Technician::Technician()
{
   rate1=40;
}

Technician::~Technician()
{

}

float Technician::pay()
{
	if(hours<=160)
	{
		float salary=rate1*hours+(float)grade*1000;
		return salary;
	}
	///////////////////////////////////////////////
	//附加功能一
	//若技术人员每月工作超过160小时,则额外的时间算作加班。加班每小时薪水为70元。
	//*程序运行要求: 输入技术人员姓名、级别、工作时间。若工作时间超过160小时,
	//要求显示加班时间、编号、级别和本月月薪;
	//若工作时间在160小时以内,则只显示编号、级别和本月月薪。
	//考虑:将加班时间作为一个弹出消息框来显示,因为单独做一个输出框不合适。
	else
	{
		float salary=rate1*160+70*(hours-160)+(float)grade*1000;
		CString str1="您本月的加班时间是:";
		CString str2="小时,辛苦了!  ";
        CString str3=(CString)(hours-160);
		str3.Format("%d",hours-160);
		AfxMessageBox(str1+str3+str2);
		return salary;
	}
}

⌨️ 快捷键说明

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