Steven_Tian
unread,Nov 11, 2010, 11:48:19 PM11/11/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Good Ideas
package model;
public class Methods {
public double sum(double a, double b, double c) {
double all = a + b + c;
double all2 = 0;
if (all <= 24000) {
all2 = (all * 0.040238095) + (all * 0.027285714);
} else if (all <= 27600) {
all2 = (all * 0.040208333) + (all * 0.027291667);
} else if (all <= 30300) {
// (此段省略太長不打,這sum是算實領年薪有扣除勞保費 )
}
return (all - all2) * 12;
}
public double sum2(double a, double b, double c) {
double all = (a + b + c) * 12;
double all2 = 0;
if (all <= 370000) {
all2 = all * 0.06;
} else if (all <= 990000) {
all2 = (all * 0.13);
} else if (all <= 1980000) {
all2 = (all * 0.21);
// (此段省略太長不打,這sum2是算所得稅 )
}
return all2;
}
}
----------------------
package testService;
import java.util.Scanner;
public class TestRan {
public static void main(String[] args) {
Scanner xx = new Scanner(System.in);
System.out.println("請輸入您的月薪:");
double x = xx.nextInt();
Scanner yy = new Scanner(System.in);
System.out.println("請輸入您每月的加職金");
double y = yy.nextInt();
Scanner zz = new Scanner(System.in);
System.out.println("請輸入您的每月的獎金");
double z = zz.nextInt();
model.Methods ss = new model.Methods();
double sss = ss.sum(x, y, z);
double sss2 = ss.sum2(x, y, z);
domain.Field met = new domain.Field();
met.show(x, y, z);
System.out.println("年薪實領(以扣除勞保費)" + sss);
System.out.println("年所得稅" + sss2);
}
}
--------------------------------
package domain;
public class Field {
public void show(double a, double b, double c) {
System.out.print("您輸入月薪" + a + " ");
System.out.print("每月職務加給" + b + " ");
System.out.println("每月獎金" + c + " ");
}
}