打印工资:
题目如下:
- 有农民(farmer)、教师(teacher)、科学家(scientist)、服务生(attendant),
- 其中农民、服务生只有基本工资。教师除基本工资外,还有课酬(元/天)
- 科学家除基本工资外,还有年终奖
- 请你写出相关类,将各种类型的员工的全年工资打印出来!
效果图如下:
代码如下:
import java.util.Scanner;
/**
* 有农民(farmer)、教师(teacher)、科学家(scientist)、服务生(attendant),
* 其中农民、服务生只有基本工资。教师除基本工资外,还有课酬(元/天)
* 科学家除基本工资外,还有年终奖
* 请你写出相关类,将各种类型的员工的全年工资打印出来!
*/
public class Demo2 {
public static void main(String[] args) {
Farmer farmer = new Farmer();
Attendant attendant = new Attendant();
Teacher teacher = new Teacher();
Scientist scientist = <