급여계산 프로그램
package tryJava;
public class TryJava05 {
public static void main(String[] args) {
/*시간제 아르바이트 급여의 총 지급액(1개월 수령액)이
얼마가 되는지를 계산하는 프로그램
은
10시부터 20시까지의 시간당 지급액은 8500원,
20시부터 24시까지의 시간당 지급액은 10500원이다.
이번달 근무시간은 10시부터 20시까지는 80시간,
20시부터 24시까지는 20시간이었다.
단 급여의 총 지급액은 세금 10%를 뺀 것이다.*/
//변수와 상수 설정
int totalPaying;
int noonPaying = 8500;
int officeHoursAtNoon = 80;
int officeHoursAtNight = 20;
int nightPaying = 10500;
//총급여, 세금, 총 지급액
totalPaying =
(noonPaying * officeHoursAtNoon +
nightPaying * officeHoursAtNight);
double tax = (double)totalPaying * 0.1;
double netPaying = totalPaying - tax;
//총급여, 세금, 총 지급액 출력
System.out.println("총급여 :"+ totalPaying);
System.out.println("세액 :"+ tax);
System.out.println("총지급액 :"+ netPaying);
}
}
댓글
댓글 쓰기