廣告廣告
  加入我的最愛 設為首頁 風格修改
首頁 首尾
 手機版   訂閱   地圖  簡體 
您是第 3110 個閱讀者
 
發表文章 發表投票 回覆文章
  可列印版   加為IE收藏   收藏主題   上一主題 | 下一主題   
ZONAˇ
數位造型
個人文章 個人相簿 個人日記 個人地圖
路人甲
級別: 路人甲 該用戶目前不上站
推文 x0 鮮花 x0
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片
推文 x0
[Java][求助] 各位java高手 請幫幫我~~~>"<
各位好 我在網路上實在找不到我的相關問題 所以我想請教各位一下>"<
我的作業是要做一個類似計算機的面盤
他要輸入學生成績 輸入完後按+(成績相加)
直到全部輸入完後按#
而每個學生的成績會在分類
如A=90~99
B=80~89
.
.
.
F=01~49
下面的TextArea會出現
一共有" "個學生 總成績為" " 平均成績為" "
及A~F的學生各是幾個

我現在只會做到成績彼此相加....ˊ ˋ
我實在是不知道怎麼在相加間並記算一共有幾個學生
但這樣便無法隻道平均成績以及A~F的分類了......

以下是我做的部分 可以幫我看一下嗎?




// Tutorial 10: InterestCalculator.java
// Calculate the total value of an investment.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.text.*;
import java.util.Date;

public class FutureValueCalculator_OK extends JFrame
{
// JLabel and JTextField for user to input security code
private JLabel studentgradeJLabel;
private JTextField studentgradeJTextField;

// JButtons to represent security keypad
// JButtons to represent security keypad
private JButton oneJButton;
private JButton twoJButton;
private JButton threeJButton;
private JButton fourJButton;
private JButton fiveJButton;
private JButton sixJButton;
private JButton sevenJButton;
private JButton eightJButton;
private JButton nineJButton;
private JButton clearJButton;
private JButton zeroJButton;
private JButton enterJButton;
private JButton plusJButton;
private JButton multiplyJButton;
private JButton divideJButton;

// JLabel, JTextArea and JScrollPane to display access log
private JLabel accessLogJLabel;
private JTextArea accessLogJTextArea;
private JScrollPane accessLogJScrollPane;
private int total;
private int student;


private static String customer;

// no-argument constructor
public FutureValueCalculator_OK(String name)
{
customer=name;
createUserInterface();
}

private void createUserInterface()
{
// get content pane for attaching GUI components
Container contentPane = getContentPane();

// enable explicit positioning of GUI components
contentPane.setLayout( null );

// set up securityCodeJLabel
studentgradeJLabel = new JLabel();
studentgradeJLabel.setBounds( 16, 16, 90, 21 );
studentgradeJLabel.setText( "Student grade:" );
contentPane.add( studentgradeJLabel );

// set up securityCodeJTextField
studentgradeJTextField = new JTextField();
studentgradeJTextField.setBounds( 114, 16, 172, 26 );
studentgradeJTextField.setEditable( false );
contentPane.add( studentgradeJTextField );

// set up oneJButton
oneJButton = new JButton();
oneJButton.setBounds( 80, 64, 50, 50 );
oneJButton.setText( "1" );
contentPane.add( oneJButton );
oneJButton.addActionListener(

new ActionListener() // anonymous inner class
{
// event handler called when oneJButton is pressed
public void actionPerformed( ActionEvent event )
{
oneJButtonActionPerformed( event );
}

} // end anonymous inner class

); // end call to addActionListener

// set up twoJButton
twoJButton = new JButton();
twoJButton.setBounds( 130, 64, 50, 50 );
twoJButton.setText( "2" );
contentPane.add( twoJButton );
twoJButton.addActionListener(

new ActionListener() // anonymous inner class
{
// event handler called when twoJButton is pressed
public void actionPerformed( ActionEvent event )
{
twoJButtonActionPerformed( event );
}

} // end anonymous inner class

); // end call to addActionListener

// set up threeJButton
threeJButton = new JButton();
threeJButton.setBounds( 180, 64, 50, 50 );
threeJButton.setText( "3" );
contentPane.add( threeJButton );
threeJButton.addActionListener(

new ActionListener() // anonymous inner class
{
// event handler called when threeJButton is pressed
public void actionPerformed( ActionEvent event )
{
threeJButtonActionPerformed( event );
}

} // end anonymous inner class

); // end call to addActionListener

// set up fourJButton
fourJButton = new JButton();
fourJButton.setBounds( 80, 114, 50, 50 );
fourJButton.setText( "4" );
contentPane.add( fourJButton );
fourJButton.addActionListener(

new ActionListener() // anonymous inner class
{
// event handler called when fourJButton is pressed
public void actionPerformed( ActionEvent event )
{
fourJButtonActionPerformed( event );
}

} // end anonymous inner class

); // end call to addActionListener

// set up fiveJButton
fiveJButton = new JButton();
fiveJButton.setBounds( 130, 114, 50, 50 );
fiveJButton.setText( "5" );
contentPane.add( fiveJButton );
fiveJButton.addActionListener(

new ActionListener() // anonymous inner class
{
// event handler called when fiveJButton ..

訪客只能看到部份內容,免費 加入會員 或由臉書 Google 可以看到全部內容




獻花 x0 回到頂端 [樓 主] From:臺灣 | Posted:2008-06-17 02:15 |
overing 手機
個人文章 個人相簿 個人日記 個人地圖
初露鋒芒
級別: 初露鋒芒 該用戶目前不上站
推文 x0 鮮花 x55
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片

開五個變數放A~F五個等級的數量
然後再[+]按鈕的ActionPerformed裡面去判斷使用者KEYIN進來的成績屬於哪個等地
就++代表那個等地的變數

看你的CODE註解好像是用某個IDE去開發的~
(除非你COPY來的)
方便的話最好整個IDE的專案檔附上來


Zippy G2 600W
Intel C2Q Q9550
Gigabyte GA-X48-DQ6
Gigabyte GV-NX96T512H-B
G-skill pi 1100MHz 2Gx4
ACARD ANS-9010 32GB (Windows7 10sec boot!!)
WD 150GB(WD1500ADFD)/640GB(6400AASK)
獻花 x0 回到頂端 [1 樓] From:未知地址 | Posted:2008-06-25 00:58 |
ety 手機
數位造型
個人文章 個人相簿 個人日記 個人地圖
初露鋒芒
級別: 初露鋒芒 該用戶目前不上站
推文 x0 鮮花 x719
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片

其實, 這也不能怪他......
不信的話, 大夥可以查查現在的大學都在上什麼課......

連國立大學都不像話呢!

還不懂培基語言就直接學 Visual Basic, 還不懂 C 的直接教 Visual C++, Java 也不例外, 一堆國立大學的學生在沒有 Borland 啦, 或是其它工具的情況下, 根本不會自己寫語法......

~"~


獻花 x0 回到頂端 [2 樓] From:臺灣和信超媒體寬帶網 | Posted:2008-06-25 08:30 |
overing 手機
個人文章 個人相簿 個人日記 個人地圖
初露鋒芒
級別: 初露鋒芒 該用戶目前不上站
推文 x0 鮮花 x55
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片

這麼說也是~記得高中一上來也是就直接教Visual Basic了
不過!~比起來VB真的寫起來比C系列, JAVA來的簡單...
至少GUI的部分幾乎不用去考慮
但是相對的穩定性跟程式效能就比較差了點
可是可是~真的要入門還是蠻推Visual Basic的...


Zippy G2 600W
Intel C2Q Q9550
Gigabyte GA-X48-DQ6
Gigabyte GV-NX96T512H-B
G-skill pi 1100MHz 2Gx4
ACARD ANS-9010 32GB (Windows7 10sec boot!!)
WD 150GB(WD1500ADFD)/640GB(6400AASK)
獻花 x0 回到頂端 [3 樓] From:未知地址 | Posted:2008-06-25 17:16 |
mixccc 會員卡
數位造型
個人文章 個人相簿 個人日記 個人地圖
小人物
級別: 小人物 該用戶目前不上站
推文 x0 鮮花 x17
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片

真的啊? 我這個低手不懂,可能我比較奇怪,個人認為C/C++比較簡單,也比較好入門耶!
看來我學語言學錯了,應該從入門的日文學起,再來進階德文才是.
或者我應該先入華山去學入門的三仙劍法,再來去少林進階大力金鋼指.
開玩笑的啦! 還在思考怎麼用VBA寫DNL/INL測試的部份,呵~~~
自我檢討去.


獻花 x0 回到頂端 [4 樓] From:臺灣 | Posted:2008-06-27 01:35 |
三仙 會員卡
個人頭像
個人文章 個人相簿 個人日記 個人地圖
頭銜:以馬內利 以馬內利
版主
級別: 版主 該用戶目前不上站
版區: 程式設計
推文 x17 鮮花 x370
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片

其實我什麼都不會
所以真對不起
沒辦法幫你


挖出答案的難度,取決提問的深度!
獻花 x0 回到頂端 [5 樓] From:APNIC | Posted:2008-06-27 20:27 |

首頁  發表文章 發表投票 回覆文章
Powered by PHPWind v1.3.6
Copyright © 2003-04 PHPWind
Processed in 0.024409 second(s),query:16 Gzip disabled
本站由 瀛睿律師事務所 擔任常年法律顧問 | 免責聲明 | 本網站已依台灣網站內容分級規定處理 | 連絡我們 | 訪客留言