编程题:10
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int years = scanner.nextInt();
int hours = scanner.nextInt();
double rate;
if (years >= 5) {
rate = 50;
} else {
rate = 30;
}
double salary;
if (hours <= 40) {
salary = hours * rate;
} else {
salary = 40 * rate + (hours - 40) * rate * 1.5;
}
System.out.printf("%.2f", salary);
}
}
浙公网安备 33010602011771号