xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

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

資源簡介

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

資源截圖

代碼片段和文件信息

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;

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

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

}
return?true;
}
/**
?*?根據班級查詢
?*?@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為文件結束
?????????while?((tempString?=?reader.readLine())?!=?null)?{
?????????????if(!““.equals(tempString)){
?????????????Student?student?=?StringToStudent(tempString);??//將學生成績字符串轉換成學生對象
?????????????if(className.equals(student.getClassName()))?//如果班級與輸入的班級一致,就將學生信息添加到list中
???????????? ?list.add(student);
?????????????}
?????????}
??}?catch?(IOException?e)?{
??????????e.printStackTrace();
??????}?finally?{
??????????if?(reader?!=?null)?{
??????????????try?{
??????????????????reader.close();
??????????????}?catch?(IOException?e1)?{
??????????????}
??????????}
??????}

return?list;
}
/**
?*?根據課程查詢
?*?@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為文件結束
?????????while?((tempString?=?reader.readLine())?!=?null)?{
?????????????if(!““.equals(tempString)){
?????????????Student?student?=?StringToStudent(tempString);?//將學生成績字符串轉換成學生對象
?????????????if(courseName.equals(student.getCourseName()))//如果課程與輸入的課程一致,就將學生信息添加到list中
???????????? ?list.add(student);
?????????????}
?????????}

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????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個文件信息

評論

共有 條評論