找回密碼
 註冊
|註冊|登錄

伊莉討論區

搜索
請尊重及感激所有版主付出和奉獻發表文章前請先閱讀相關版規迅雷動畫正式開放,齊來分享!
七龍珠超一拳超人火影忍者英雄聯盟死侍神奇寶貝強姦
炎の孕まsacdゆうろtinkerbe中文 mg愛情なしぱ

休閒聊天興趣交流學術文化旅遊交流飲食交流家庭事務PC GAMETV GAME
熱門線上其他線上感情感性寵物交流家族門派動漫交流貼圖分享BL/GL
音樂世界影視娛樂女性頻道潮流資訊BT下載區GB下載區下載分享短片
電腦資訊數碼產品手機交流交易廣場網站事務長篇小說體育運動時事經濟
上班一族博彩娛樂
C & C++ 語言C# 語言Visual Basic 語言PHP 語言JAVA 語言
查看: 3605|回復: 0

[教學] IVE Lab 7.1 Sample[複製鏈接]

Rank: 10

帖子
15695
積分
28000 點
潛水值
390409 米
發表於 2005-10-27 08:53 PM|顯示全部樓層
如果瀏覽伊莉時速度太慢或無法連接,可以使用其他分流瀏覽伊莉,www01.eyny.com(02,03)。
  1. import javax.swing.*;

  2. public class tax_cal {
  3.   
  4.   static double a; static double b;
  5.   static double c; static double d;
  6.   static double e; static double f;

  7.   static double totalsum_1;
  8.   static double totalsum_2;
  9.   static double totalsum_3;
  10.   static double totalsum_4;
  11.   static double totalsum_5;
  12.   static double totalsum_6;
  13.   
  14.   static String input_filing;
  15.   static String input_income;
  16.   static int filing_status;
  17.   static int tax_income;
  18.   static double tax_result;
  19.   static double tax_rate;
  20.   static double tax_rate_1 = 10;
  21.   static double tax_rate_2 = 15;
  22.   static double tax_rate_3 = 27;
  23.   static double tax_rate_4 = 30;
  24.   static double tax_rate_5 = 35;
  25.   static double tax_rate_6 = 38.6;
  26.   static double single_range_1 = 6000;
  27.   static double single_range_2 = 27950;
  28.   static double single_range_3 = 67700;
  29.   static double single_range_4 = 141250;
  30.   static double single_range_5 = 307050;

  31.   static double married_range_1 = 12000;
  32.   static double married_range_2 = 46700;
  33.   static double married_range_3 = 112850;
  34.   static double married_range_4 = 171950;
  35.   static double married_range_5 = 307050;
  36.   
  37.   static double marrieds_range_1 = 6000;
  38.   static double marrieds_range_2 = 23350;
  39.   static double marrieds_range_3 = 56425;
  40.   static double marrieds_range_4 = 85975;
  41.   static double marrieds_range_5 = 153525;
  42.   
  43.   static double owner_range_1 = 10000;
  44.   static double owner_range_2 = 37450;
  45.   static double owner_range_3 = 96700;
  46.   static double owner_range_4 = 156600;
  47.   static double owner_range_5 = 307050;
  48.   static double x;
  49.   static double y;
  50.   static double z;
  51.   static double w;
  52.   
  53.   
  54.   public static void main(String[] args) {
  55.    
  56.     input_filing = JOptionPane.showInputDialog(null, "Select your status:\n0. Single\n1. Married Jointly\n2. Married Separately\n3. Household Owner", "Select your status",
  57.                                                JOptionPane.QUESTION_MESSAGE);
  58.    
  59.     filing_status = Integer.parseInt(input_filing);
  60.    
  61.     input_income = JOptionPane.showInputDialog(null, "Input your income for month", "Input your income", JOptionPane.QUESTION_MESSAGE);
  62.    
  63.     tax_income = Integer.parseInt(input_income);
  64.    
  65.     switch(filing_status) {
  66.       
  67.       case 0 :
  68.       a = single_range_1;
  69.       b = single_range_2;
  70.       c = single_range_3;
  71.       d = single_range_4;
  72.       e = single_range_5;

  73.       if (tax_income <= single_range_1) {
  74.         tax_rate = tax_rate_1;
  75.       } else if (tax_income <= single_range_2) {
  76.         tax_rate = tax_rate_2;
  77.       } else if (tax_income <= single_range_3) {
  78.         tax_rate = tax_rate_3;
  79.       } else if (tax_income <= single_range_4) {
  80.         tax_rate = tax_rate_4;
  81.       } else if (tax_income <= single_range_5) {
  82.         tax_rate = tax_rate_5;
  83.       } else if (tax_income > single_range_5)  {
  84.         tax_rate = tax_rate_6;
  85.       
  86.       }
  87.       break;
  88.       case 1 :
  89.       a = married_range_1;
  90.       b = married_range_2;
  91.       c = married_range_3;
  92.       d = married_range_4;
  93.       e = married_range_5;

  94.       
  95.       if (tax_income <= married_range_1) {
  96.         tax_rate = tax_rate_1;
  97.       } else if (tax_income <= married_range_2) {
  98.         tax_rate = tax_rate_2;
  99.       } else if (tax_income <= married_range_3) {
  100.         tax_rate = tax_rate_3;
  101.       } else if (tax_income <= married_range_4) {
  102.         tax_rate = tax_rate_4;
  103.       } else if (tax_income <= married_range_5) {
  104.         tax_rate = tax_rate_5;
  105.       } else {
  106.         tax_rate = tax_rate_6;
  107.       }
  108.       break;
  109.       case 2 :
  110.       a = marrieds_range_1;
  111.       b = marrieds_range_2;
  112.       c = marrieds_range_3;
  113.       d = marrieds_range_4;
  114.       e = marrieds_range_5;

  115.       if (tax_income <= marrieds_range_1) {
  116.         tax_rate = tax_rate_1;
  117.       } else if (tax_income <= marrieds_range_2) {
  118.         tax_rate = tax_rate_2;
  119.       } else if (tax_income <= marrieds_range_3) {
  120.         tax_rate = tax_rate_3;
  121.       } else if (tax_income <= married_range_4) {
  122.         tax_rate = tax_rate_4;
  123.       } else if (tax_income <= marrieds_range_5) {
  124.         tax_rate = tax_rate_5;
  125.       } else {
  126.         tax_rate = tax_rate_6;
  127.       }
  128.       break;
  129.       case 3 :
  130.       a = owner_range_1;
  131.       b = owner_range_2;
  132.       c = owner_range_3;
  133.       d = owner_range_4;
  134.       e = owner_range_5;

  135.       if (tax_income <= owner_range_1) {
  136.         tax_rate = tax_rate_1;
  137.       } else if (tax_income <= owner_range_2) {
  138.         tax_rate = tax_rate_2;
  139.       } else if (tax_income <= owner_range_3) {
  140.         tax_rate = tax_rate_3;
  141.       } else if (tax_income <= owner_range_4) {
  142.         tax_rate = tax_rate_4;
  143.       } else if (tax_income <= owner_range_5) {
  144.         tax_rate = tax_rate_5;
  145.       } else {
  146.         tax_rate = tax_rate_6;
  147.       }
  148.       break;
  149.     }
  150.     totalsum_1 = (tax_income * tax_rate_1 / 100);
  151.     totalsum_2 = ((tax_income - a) * tax_rate_2 / 100) + (a * tax_rate_1 / 100);
  152.     totalsum_3 = ((tax_income - b) * tax_rate_3 / 100) + ((b - a) * tax_rate_2 / 100) + (a * tax_rate_1 / 100);
  153.     totalsum_4 = ((tax_income - c) * tax_rate_4 / 100) + ((c - b) * tax_rate_3 / 100) + ((b - a) * tax_rate_2 / 100) + (a * tax_rate_1 / 100);
  154.     totalsum_5 = ((tax_income - d) * tax_rate_5 / 100) + ((d - c) * tax_rate_4 / 100) + ((c - b) * tax_rate_3 / 100) + ((b - a) * tax_rate_2 / 100) + (a * tax_rate_1 / 100);
  155.     totalsum_6 = ((tax_income - e) * tax_rate_6 / 100) + ((e - d) * tax_rate_5 / 100) + ((d - c) * tax_rate_4 / 100) + ((c - b) * tax_rate_3 / 100) + ((b - a) * tax_rate_2 / 100) + (a * tax_rate_1 / 100);
  156.     if (tax_rate <= tax_rate_1) {
  157.       tax_result = totalsum_1;
  158.     } else if (tax_rate <= tax_rate_2) {
  159.       tax_result = totalsum_2;
  160.     } else if (tax_rate <= tax_rate_3) {
  161.       tax_result = totalsum_3;
  162.     } else if (tax_rate <= tax_rate_4) {
  163.       tax_result = totalsum_4;
  164.     } else if (tax_rate <= tax_rate_5) {
  165.       tax_result = totalsum_5;
  166.     } else if (tax_rate <= tax_rate_6) {
  167.       tax_result = totalsum_6;
  168.     }
  169.     System.out.println("The tax amount is " + tax_result);
  170.    
  171.   }
  172. }
複製代碼
...
瀏覽完整內容,請先 註冊登入會員
附件: 你需要登錄才可以下載或查看附件。沒有帳號?註冊

使用道具檢舉

您需要登錄後才可以回帖 登錄 | 註冊

Powered by Discuz!

© Comsenz Inc.

重要聲明:本討論區是以即時上載留言的方式運作,對所有留言的真實性、完整性及立場等,不負任何法律責任。而一切留言之言論只代表留言者個人意見,並非本網站之立場,用戶不應信賴內容,並應自行判斷內容之真實性。於有關情形下,用戶應尋求專業意見(如涉及醫療、法律或投資等問題)。 由於本討論區受到「即時上載留言」運作方式所規限,故不能完全監察所有留言,若讀者發現有留言出現問題,請聯絡我們。有權刪除任何留言及拒絕任何人士上載留言,同時亦有不刪除留言的權利。切勿上傳和撰寫 侵犯版權(未經授權)、粗言穢語、誹謗、渲染色情暴力或人身攻擊的言論,敬請自律。本網站保留一切法律權利。
回頂部