hourlyworker.java

来自「国外的数据结构与算法分析用书」· Java 代码 · 共 25 行

JAVA
25
字号
/**	A class for an Employee that works by the hour.  It includes variables
	for the hourly wage and the hours worked. */
public class HourlyWorker extends Employee
{
	/**	Hourly wage of the Employee. */
	float hourlyWage;

	/**	Hours worked by the Employee. */
	float hoursWorked;

	/**	Constructor that initializes the name, address, employee number, hourly rate, and hours. */
	public HourlyWorker(String n, String a, int e, float wage, float hours)
	{
		super(n, a, e);
		hourlyWage = wage;
		hoursWorked = hours;
	}

	/**	String representation of the Employee and salary information. */
	public String toString()
	{
		return super.toString() + "Employee salary: $" + hourlyWage * hoursWorked + "\n";
	}
}

⌨️ 快捷键说明

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