/**
* 定义一个方法处理公司的迟到问题
* 1.输入迟到时间和月薪
* 2.处理逻辑:
* 迟到1-10分钟,警告
* 迟到11-20分钟,罚款100
* 迟到21-30分钟,罚款200
* 迟到30分钟以上,扣除半天工资
* 迟到一小时以上,按照旷工计算,扣除三天工资
* 3.输出:罚款金额
*/
import java.util.Scanner;
public class Test_Method {
public static void handlelate(int minutes, double month_salary) {
double fine = 0;
if (minutes > 60) {
System.out.println("迟到"+minutes+"分钟,按照矿工计算,扣除三天工资。");
fine = (month_salary / 30) * 3;
} else if (minutes > 30) {
System.out.println("迟到"+minutes+"分钟,扣除半天工资。");
fine = (month_salary / 60);
} else if (minutes > 20) {
System.out.println("迟到"+minutes+"分钟,罚款200");
fine = 200;
} else if (minutes > 10) {
System.out.println("迟到"+minutes+"分钟,罚款100");
fine = 100;
} else {
System.out.println("迟到"+minutes+"分钟,警告");
fine = 0;
}
System.out.println("输入罚金:" + fine);
}
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.println("请输入迟到的时间(按分钟计算):");
int minutes = s.nextInt();
System.out.println("请输入月薪:");
double month_salary = s.nextDouble();
handlelate(minutes, month_salary);
}
}