91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 32.7MB
    文件類型: .zip
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2023-07-04
  • 語(yǔ)言: Java
  • 標(biāo)簽: JAVA??IO??文件??

資源簡(jiǎn)介

yu華南理工大學(xué)網(wǎng)絡(luò)學(xué)院2014秋季 “計(jì)算機(jī)操作系統(tǒng)”課程設(shè)計(jì)大作業(yè) 一、題目: 用文件實(shí)現(xiàn)的學(xué)生成績(jī)管理系統(tǒng) 二、目的 學(xué)生通過(guò)本次實(shí)驗(yàn)編程實(shí)現(xiàn)一個(gè)班級(jí)學(xué)生成績(jī)的管理,使學(xué)生了解文件的主要操作(創(chuàng)建、讀、寫、增加和刪除記錄等)。 三、內(nèi)容和要求 1、編寫一個(gè)學(xué)生成績(jī)管理的軟件系統(tǒng),語(yǔ)言不限。 2、軟件中能夠隨時(shí)增加學(xué)生成績(jī)記錄(姓名、班級(jí)、學(xué)號(hào)、課程名稱、成績(jī)),這些記錄存放到磁盤文件中。 3、利用磁盤文件的系統(tǒng)接口函數(shù)編程實(shí)現(xiàn)對(duì)學(xué)生成績(jī)進(jìn)行管理:以各種方式查詢成績(jī)、修改成績(jī);顯示所有的學(xué)生成績(jī)。 4、編寫將一個(gè)班級(jí)的成績(jī)復(fù)制到另一個(gè)文件的功能。 5、學(xué)習(xí)使用文件編程,實(shí)現(xiàn)指定班級(jí)成績(jī)文件的刪除操作。 6、能夠?qū)W(xué)生成績(jī)記錄進(jìn)行文件備份和還原。 7、本實(shí)驗(yàn)的目的是練習(xí)文件操作,因此該軟件不能使用數(shù)據(jù)庫(kù)存放信息,只能用普通文件存放信息。

資源截圖

代碼片段和文件信息

import?java.io.BufferedReader;
import?java.io.File;
import?java.io.FileReader;
import?java.io.FileWriter;
import?java.io.IOException;
import?java.util.ArrayList;
import?java.util.List;

/**
?*?操作文件?實(shí)現(xiàn)對(duì)文件的創(chuàng)建、讀、寫、刪除等操作
?*?學(xué)生成績(jī)的添加、查找、修改?是將文件內(nèi)容讀取到內(nèi)存list中,進(jìn)行操作,完成后,將內(nèi)容寫回到文件中
?*?@author?Administrator
?*
?*/
public?class?FileUtil?{
private?static?final?String?mainFileName?=?“main.db“;
/**
?*?添加學(xué)生成績(jī)?保存到文件
?*?@param?content
?*?@return
?*/
public?static?boolean?saveFileContent(String?content){
FileWriter?writer?=?null;
try?{
String?path?=?System.getProperty(“user.dir“);//獲取當(dāng)前路徑
String?fileName?=?path+“/“+mainFileName;//學(xué)生成績(jī)文件(主文件)
File?file?=?new?File(fileName);
if(!file.exists())//判斷該文件是否存在
file.createNewFile();//不存在新建一個(gè)空文件
writer?=?new?FileWriter(fileName?true);
writer.write(content+“\n“);//學(xué)生成績(jī)寫入文件

}?catch?(IOException?e)?{
e.printStackTrace();
return?false;
}finally{
try?{
writer.close();
}?catch?(IOException?e)?{
e.printStackTrace();
}

}
return?true;
}
/**
?*?根據(jù)班級(jí)查詢
?*?@param?className
?*?@return
?*/
public?static?List?queryByClassName(String?className){
BufferedReader?reader?=?null;
List?list?=?new?ArrayList();
try{
String?path?=?System.getProperty(“user.dir“);
String?fileName?=?path+“/“+mainFileName;
File?file?=?new?File(fileName);
?reader?=?new?BufferedReader(new?FileReader(file));
?????????String?tempString?=?null;
?????????//?一次讀入一行,直到讀入null為文件結(jié)束
?????????while?((tempString?=?reader.readLine())?!=?null)?{
?????????????if(!““.equals(tempString)){
?????????????Student?student?=?StringToStudent(tempString);??//將學(xué)生成績(jī)字符串轉(zhuǎn)換成學(xué)生對(duì)象
?????????????if(className.equals(student.getClassName()))?//如果班級(jí)與輸入的班級(jí)一致,就將學(xué)生信息添加到list中
???????????? ?list.add(student);
?????????????}
?????????}
??}?catch?(IOException?e)?{
??????????e.printStackTrace();
??????}?finally?{
??????????if?(reader?!=?null)?{
??????????????try?{
??????????????????reader.close();
??????????????}?catch?(IOException?e1)?{
??????????????}
??????????}
??????}

return?list;
}
/**
?*?根據(jù)課程查詢
?*?@param?courseName
?*?@return
?*/
public?static?List?queryByCourseName(String?courseName){
BufferedReader?reader?=?null;
List?list?=?new?ArrayList();
try{
String?path?=?System.getProperty(“user.dir“);
String?fileName?=?path+“/“+mainFileName;
File?file?=?new?File(fileName);
?reader?=?new?BufferedReader(new?FileReader(file));
?????????String?tempString?=?null;
?????????//?一次讀入一行,直到讀入null為文件結(jié)束
?????????while?((tempString?=?reader.readLine())?!=?null)?{
?????????????if(!““.equals(tempString)){
?????????????Student?student?=?StringToStudent(tempString);?//將學(xué)生成績(jī)字符串轉(zhuǎn)換成學(xué)生對(duì)象
?????????????if(courseName.equals(student.getCourseName()))//如果課程與輸入的課程一致,就將學(xué)生信息添加到list中
???????????? ?list.add(student);
?????????????}
?????????}

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2014-11-24?15:27??StudentCourse\
?????目錄???????????0??2014-11-24?15:26??StudentCourse\exe\
?????目錄???????????0??2014-11-22?09:46??StudentCourse\exe\backup\
?????目錄???????????0??2014-11-22?09:52??StudentCourse\exe\data\
?????文件???????12002??2014-11-25?09:33??StudentCourse\exe\FileUtil.class
?????目錄???????????0??2014-11-22?09:46??StudentCourse\exe\jre\
?????目錄???????????0??2014-11-22?09:46??StudentCourse\exe\jre\bin\
?????文件???????10240??2011-09-17?10:28??StudentCourse\exe\jre\bin\attach.dll
?????文件?????1208320??2011-09-17?10:28??StudentCourse\exe\jre\bin\awt.dll
?????文件??????114688??2011-09-17?10:28??StudentCourse\exe\jre\bin\axbridge.dll
?????目錄???????????0??2014-11-22?09:46??StudentCourse\exe\jre\bin\client\
?????文件?????2641920??2011-09-17?10:28??StudentCourse\exe\jre\bin\client\jvm.dll
?????文件????????1447??2011-09-17?10:28??StudentCourse\exe\jre\bin\client\Xusage.txt
?????文件??????192512??2011-09-17?10:28??StudentCourse\exe\jre\bin\cmm.dll
?????文件??????143360??2011-09-17?10:28??StudentCourse\exe\jre\bin\dcpr.dll
?????文件???????77824??2011-09-17?10:28??StudentCourse\exe\jre\bin\deploy.dll
?????文件??????405504??2011-09-17?10:28??StudentCourse\exe\jre\bin\deployJava1.dll
?????文件???????16896??2011-09-17?10:28??StudentCourse\exe\jre\bin\dt_shmem.dll
?????文件???????13312??2011-09-17?10:28??StudentCourse\exe\jre\bin\dt_socket.dll
?????文件???????69632??2011-09-17?10:28??StudentCourse\exe\jre\bin\eula.dll
?????文件??????339968??2011-09-17?10:28??StudentCourse\exe\jre\bin\fontmanager.dll
?????文件???????15872??2011-09-17?10:28??StudentCourse\exe\jre\bin\hpi.dll
?????文件??????139264??2011-09-17?10:28??StudentCourse\exe\jre\bin\hprof.dll
?????文件???????98304??2011-09-17?10:28??StudentCourse\exe\jre\bin\instrument.dll
?????文件???????12800??2011-09-17?10:28??StudentCourse\exe\jre\bin\ioser12.dll
?????文件????????7680??2011-09-17?10:28??StudentCourse\exe\jre\bin\j2pcsc.dll
?????文件???????41984??2011-09-17?10:28??StudentCourse\exe\jre\bin\j2pkcs11.dll
?????文件???????10240??2011-09-17?10:28??StudentCourse\exe\jre\bin\jaas_nt.dll
?????文件??????126976??2011-09-17?10:28??StudentCourse\exe\jre\bin\java.dll
?????文件??????139264??2011-09-17?10:28??StudentCourse\exe\jre\bin\java.exe
?????文件???????73728??2011-09-17?10:28??StudentCourse\exe\jre\bin\javacpl.cpl
............此處省略78個(gè)文件信息

評(píng)論

共有 條評(píng)論

相關(guān)資源