史萊姆論壇

返回   史萊姆論壇 > 專業主討論區 > 程式語言討論區
忘記密碼?
論壇說明

歡迎您來到『史萊姆論壇』 ^___^

您目前正以訪客的身份瀏覽本論壇,訪客所擁有的權限將受到限制,您可以瀏覽本論壇大部份的版區與文章,但您將無法參與任何討論或是使用私人訊息與其他會員交流。若您希望擁有完整的使用權限,請註冊成為我們的一份子,註冊的程序十分簡單、快速,而且最重要的是--註冊是完全免費的!

請點擊這裡:『註冊成為我們的一份子!』

Google 提供的廣告


 
 
主題工具 顯示模式
舊 2007-07-16, 11:54 AM   #3 (permalink)
garfieldking
榮譽勳章

勳章總數
UID -
在線等級:
文章: n/a
精華:
預設

基本上它是一個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){

}
}

}
 
送花文章: 0, 收花文章: 0 篇, 收花: 0 次
回覆時引用此帖
 



發表規則
不可以發文
不可以回覆主題
不可以上傳附加檔案
不可以編輯您的文章

論壇啟用 BB 語法
論壇啟用 表情符號
論壇啟用 [IMG] 語法
論壇禁用 HTML 語法
Trackbacks are 禁用
Pingbacks are 禁用
Refbacks are 禁用


所有時間均為台北時間。現在的時間是 10:57 PM


Powered by vBulletin® 版本 3.6.8
版權所有 ©2000 - 2026, Jelsoft Enterprises Ltd.


SEO by vBSEO 3.6.1