找回密碼 或 安全提問
 註冊
|註冊|登錄

伊莉討論區

搜索
感激所有對伊莉作出奉獻的人發表文章前請先閱讀相關版規認識好友、聊天,分享生活趣事
mg火影cosplay上原亞衣cosplay3d無碼 ge
ルナソフ羅賓漢海賊王geカルミアseed fre2337712

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

【高清繁中】✡ 霹靂

(4月新番)[繁]關於我

(4月新番)[繁]魔法科

關於我轉生變成史萊姆

❖四月新番【簡】無名

[簡]被稱為廢物的原英
C & C++ 語言C# 語言Visual Basic 語言PHP 語言JAVA 語言
查看: 3697|回復: 0
打印上一主題下一主題

[教學] IVE Exercise 3.1 Sample[複製鏈接]

Rank: 10

帖子
15722
積分
28040 點
潛水值
400319 米
跳轉到指定樓層
樓主
發表於 2005-10-27 06:35 PM|只看該作者|倒序瀏覽
  1. // Exercise 3.1

  2. import javax.swing.*;

  3. public class sale_amount {
  4.   
  5.   static String input_goal_st;
  6.   static int input_goal_int;
  7.   static double base_salary = 5000;
  8.   static double rate_1 = 8;
  9.   static double rate_2 = 10;
  10.   static double rate_3 = 12;
  11.   static double limit_high_1 = 5000;
  12.   static double limit_high_2 = 10000;
  13.   static double limit_high_3 = 10000.01;
  14.   static double limit_low_1 = 0.01;
  15.   static double limit_low_2 = 5000;
  16.   static double limit_low_3 = 10000;
  17.   static String range_1 = "$0.01 - $5,000";
  18.   static String range_2 = "$5,000.01 - $10,000";
  19.   static String range_3 = "$10,000.01 and above";
  20.   static double total_month = 12;
  21.   static double mini_amount;
  22.   static double sale_amount;
  23.   static double sale_amount_final;
  24.   static String x;
  25.   static double y;
  26.   static double z;
  27.   static double w;
  28.   static int i;
  29.   
  30.   public static void main(String[] args) {
  31.    
  32.     input_goal_st = JOptionPane.showInputDialog(null, "Input your targe commission of this year", "Calculation of commission",
  33.                                                 JOptionPane.QUESTION_MESSAGE);
  34.    
  35.     input_goal_int = Integer.parseInt(input_goal_st);
  36.    
  37.     for(i = 1; i <= 3; i++) {
  38.       
  39.       switch(i) {
  40.         case 1 : x = range_1; y = limit_high_1; z = rate_1; w = limit_low_1;
  41.         break;
  42.         case 2 : x = range_2; y = limit_high_2; z = rate_2; w = limit_low_2;
  43.         break;
  44.         case 3 : x = range_3; y = limit_high_3; z = rate_3; w = limit_low_3;
  45.         break;
  46.       }
  47.       
  48.       mini_amount = (w * total_month);
  49.       sale_amount = (base_salary) + (y * (z / 100) * total_month);
  50.       
  51.       if (sale_amount >= input_goal_int) {
  52.         sale_amount_final = (input_goal_int - base_salary) * (100 / z);
  53.         if ( sale_amount_final >= mini_amount) {
  54.         System.out.println("The sale amount to meet your goal is " + sale_amount_final + "\nCommission rate is " + z + "\nSales amount range is " + x);
  55.         JOptionPane.showMessageDialog(null, "The sale amount to meet your goal is " + sale_amount_final + "\nCommission rate is " + z + "\nSales amount range is " + x, "The information of the calculation", JOptionPane.INFORMATION_MESSAGE);
  56.         } else {
  57.           continue;
  58.         }
  59.       } else if(i == 3) {
  60.         sale_amount_final = (input_goal_int - base_salary) * (100 / rate_3);
  61.         if ( sale_amount_final >= mini_amount) {
  62.           System.out.println("The sale amount to meet your goal is " + sale_amount_final + "\nCommission rate is " + z + "\nSales amount range is " + x);
  63.                 JOptionPane.showMessageDialog(null, "The sale amount to meet your goal is " + sale_amount_final + "\nCommission rate is " + z + "\nSales amount range is " + x, "The information of the calculation", JOptionPane.INFORMATION_MESSAGE);
  64.         } else {
  65.           continue;
  66.         }     
  67.       } else {
  68.         continue;
  69.       }
  70.     }
  71.   }
  72. }
複製代碼
...
瀏覽完整內容,請先 註冊登入會員
附件: 你需要登錄才可以下載或查看附件。沒有帳號?註冊
分享分享0收藏收藏0支持支持0

使用道具檢舉

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

Powered by Discuz!

© Comsenz Inc.

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