![]() |
學校JAVA的功課..請問有人可以教我嗎?
我有一個JAVA程式...原本想把他傳上來
但是我沒有找到上傳的功能 所以我想請問各位有沒有人可以提供EMAIL然後可以跟我一起討論教我的 因為功課是英文的...人在美國念書 怕翻譯的不好...所以沒寫成中文 所已請各位大大幫幫忙 給我你的EMAIL 然後我寄檔案給你 謝謝 |
先po程式碼上來看看吧,
你這麼說大家也不知道你的作業是在做什麼? :on_22: :on_22: :on_22: |
基本上它是一個5*5 dimension的array
c0 c1 c2 c3 c4 ------|------|-----|-----|-----|----- r0 ------|------|-----|-----|-----|----- r1 ------|------|-----|-----|-----|----- r2 ------|------|-----|-----|-----|----- r3 ------|------|-----|-----|-----|----- r4 ------|------|-----|-----|-----|----- 然後我建立五個選擇給使用者 a) Edit cell value b) Change size c) Read from CSV file d) Write to CSV file e) Exit 使用者選擇上面五個功能來display 那個spread sheet e.g 選a 接下來他就會問你要哪行哪列 e.g r2c3 然後填入一個新的value給你上面所填入的框框, e.g coke 然後r2c3就會印出coke ------------------------------------------------------------------------ 這是我目前寫出來的(在下面) 只有一點點 希望懂的人可以幫幫我 謝謝 ------------------------------------------------------------------------ import java.util.*; import java.io.*; public class spreadSheet { //defining the private members of constant private String[][] spreadBoard; private String cellPos; //creating an empty spreadsheet board initially start with 5*5 public spreadSheet(int rdim,int cdim){ spreadBoard = new String[rdim][cdim]; for(int row=5; row<spreadBoard.length; row++){ for(int col=5; col<spreadBoard.length; col++){ spreadBoard[row][col]=""; } } } //creating a constructor which takes two int parameter to indicate row and columns public spreadSheet(String[][] arr, int i, int j){ if(i<0 || j<0){ throw new IllegalArgumentException("Rows and columns are not positive numbers"); } else{ cellPos = arr[i][j]; } } //creating a constructor of file object to read file public static void main(String[] args)throws IOException{ Scanner stdin = new Scanner(System.in); System.out.println("File: "); String name = stdin.nextLine(); File file = new File(name); Scanner fileIn = new Scanner(file); while(fileIn.hasNext()){ String currentFile = fileIn.nextLine(); } } //creating //a method to set cell of number of row and column to be string public static String setCell(String[][] cel,int rnum, int cnum){ return cel[rnum][cnum]; if(rnum=="," || cnum==","){ throw new IllegalArgumentException(); } else if(cel > spreadBoard.length){ } } } |
我的EMAIL是sisy5021@hotmail.com
還有就是我覺得我最後寫那個IF LOOP裡面的參數是錯誤的 但是我不懂為什麼 那些是到目前為止寫的 請幫幫我 謝謝你們 |
建議你使用 eclipse 先 debug 一下
看看有什麼問題 |
所有時間均為台北時間。現在的時間是 11:45 AM。 |
Powered by vBulletin® 版本 3.6.8
版權所有 ©2000 - 2025, Jelsoft Enterprises Ltd.
『服務條款』
* 有問題不知道該怎麼解決嗎?請聯絡本站的系統管理員 *