Thanks to visit codestin.com
Credit goes to github.com

Skip to content

本项目是华南理工大学软件学院的Java语言程序设计实验报告,涵盖了Java运行环境配置、面向对象编程技术、接口实现与异常处理、以及GUI程序设计与I/O文件处理等实验内容。通过一系列实验步骤,学生将掌握Java编程的基本技能和高级特性。

Notifications You must be signed in to change notification settings

NoahIsARider/JavaBankProject

Repository files navigation

English

JavaBankProject

Experiment 1 - Familiarize with the Java Runtime Environment

Experimental Questions

  1. Environment Variable Configuration (5 points)

    • Set the environment variables and take a screenshot (3 points)
    • Run java -version and take a screenshot (2 points)
  2. Step 1 Folder (14 points)

    • The implementation code or a screenshot of the code for the Account class (10 points)
    • Compile the .java file using javac and take a screenshot (2 points)
    • Run the TestBanking file and take a screenshot (2 points)
  3. Step 2 Folder (12 points)

    • The implementation code or a screenshot of the code for the Customer class (10 points)
    • Run the TestingBanking file and take a screenshot (2 points)
  4. Step 3 Folder (22 points)

    • The implementation code or a screenshot of the code for the deposit method (10 points)
    • The implementation code or a screenshot of the code for the withdraw method (10 points)
    • Run the TestBanking file and take a screenshot (2 points)
  5. Step 4 Folder (12 points)

    • The implementation code or a screenshot of the code for the Bank class (10 points)
    • Run the TestBanking file and take a screenshot (2 points)

Thought Questions

  1. Suppose the TestBanking class references the Account class and the Customer class. After editing the source files of the three classes, only compiling the TestBanking.java source file also generates the class files of the other classes. Why? Further summarize, when the compiler needs information about a certain class, how does it search for the source file or class file that defines the class?

  2. Suppose the Banking.Customer class and the Banking.Account class have been defined, and the Customer class references the Account class. If you directly run Javac customer.java in the directory where the class is located (under the /banking sub - directory), an error will occur. Please analyze the reason for the error.

  3. Describe the function of the -classpath classpath. Think about how the JDK compiler and virtual machine locate the required class files. Summarize the order in which the compiler searches for classes and the order in which the JVM searches for classes.

Experiment 2 - Object - Oriented Programming Techniques

Experimental Questions

  1. Step 5 Folder

    • The implementation code or a screenshot of the code for the Account class (10 points)
    • The implementation code or a screenshot of the code for the SavingAccount class (10 points)
    • The implementation code or a screenshot of the code for the CheckingAccount class (10 points)
    • The modified code or a screenshot of the code for the TestBanking class, run the TestBanking file and take a screenshot (2 points)
  2. Step 6 - PR1 Folder

    • The implementation code or a screenshot of the code for the Customer class (10 points)
    • Run the TestBanking file and take a screenshot (1 point)
  3. Step 6 - PR2 Folder

    • The implementation code or a screenshot of the code for the Bank class (10 points)
    • The implementation code or a screenshot of the code for the CustomerReport class (10 points)
    • Run the TestBanking file and take a screenshot (2 points)

Thought Questions

  1. Think about how to sort the Account collection defined by ArrayList in ascending order of the account balance. Please describe the implementation idea or key statements.

  2. Summarize the design principle of the singleton pattern. Think about why the attributes and methods are static and the constructor is private.

Experiment 3 - Interface Implementation and Exception Handling

Experimental Questions

  1. Step 6 Folder

    • The implementation code or a screenshot of the code for the sortCustomers method (10 points)
    • The implementation code or a screenshot of the code for the searchCustomers method (5 points)
    • The implementation code or a screenshot of the code for the compareTo method (10 points)
    • The implementation code or a screenshot of the code for the CustomerReport class (5 points)
    • Run the TestBanking file and take a screenshot (5 points)
  2. Step 7 Folder

    • The implementation code or a screenshot of the code for the OverdraftException class (15 points)
    • The implementation code or a screenshot of the code for the withdraw method in the Account class (5 points)
    • The implementation code or a screenshot of the code for the withdraw method in the CheckingAccount class (5 points)
    • Run the TestBanking file and take a screenshot (5 points)

Thought Questions

  1. How many class files are generated after compiling this program?

  2. Create a class Bird (bird), give its sound characteristics, and create an instance of the Bird class in the main class and output its characteristics.

  3. How to write an abstract class to replace the interface in the program to achieve the same function of the program. Try to compare their differences.

Experiment 4 - GUI Program Design and I/O File Processing

Experimental Questions

  1. Create a Java project, import the AddressBook.java and FixedLengthStringIO.java files, compile and run it, and take a screenshot of the running result (10 points)

  2. Step 8

    • Create a new banking.DAO package, import FixedLengthStringIO.java into this package, and create a new CustomerDAO.java. The CustomerDAO class encapsulates all methods for accessing the Customer file. The implementation code or a screenshot of the code for the CustomerDAO class. (20 points)
    • Modify the Bank class, call the methods of the CustomerDAO class to make it support reading customers from the file or saving customers to the file. The implementation code or a screenshot of the code for the Bank class. (20 points)
    • Create a new banking.UI package, create a new MainWindow.java, call the methods of the Bank class to handle the display of interface components and corresponding button events. The implementation code or a screenshot of the code for the MainWindow class. (20 points)
    • Run the MainWindow file and take screenshots of the interfaces for adding customers, deleting customers, searching for customers, and sorting customers. (20 points)
      • Add a customer:
      • Delete a customer:
      • Search for a customer:
      • Sort customers (by last name):

Chinese

JavaBankProject

实验1 - 熟悉Java运行环境

实验题

  1. 环境变量配置(5分)

    • 环境变量设置并截图(3分)
    • java -version并截图(2分)
  2. Step 1文件夹(14分)

    • Account类实现代码或代码截图(10分)
    • 使用javac编译.java文件并截图(2分)
    • 运行TestBanking文件并截图(2分)
  3. Step 2文件夹(12分)

    • Customer类实现代码或代码截图(10分)
    • 运行TestingBanking文件并截图(2分)
  4. Step 3文件夹(22分)

    • deposit方法实现代码或代码截图(10分)
    • withdraw方法实现代码或代码截图(10分)
    • 运行TestBanking文件并截图(2分)
  5. Step 4文件夹(12分)

    • Bank类实现代码或代码截图(10分)
    • 运行TestBanking文件并截图(2分)

思考题

  1. 假设在TestBanking类中引用了Account类和Customer类,在编辑了三个类的源文件后,仅编译TestBanking.java源文件同时也生成了其他类的类文件,为什么?进一步归纳,当编译器需要某个类的信息时,如何搜索定义该类的源文件或类文件?

  2. 假设已定义了Banking.Customer类和Banking.Account类,并且Customer类中引用了Account类,若直接在该类所在目录(/banking子目录下)运行Javac customer.java会出错,请分析出错原因。

  3. 描述-classpath类路径的作用,思考JDK的编译器和虚拟机是如何定位到所需的类文件的?归纳编译器搜索类的顺序以及JVM搜索类的顺序。

实验2 - 面向对象的编程技术

实验题

  1. Step 5文件夹

    • Account类实现代码或代码截图(10分)
    • SavingAccount类实现代码或代码截图(10分)
    • CheckingAccount类实现代码或代码截图(10分)
    • TestBanking类修改代码或代码截图,运行TestBanking文件并截图(2分)
  2. Step 6 - PR1文件夹

    • Customer类实现代码或代码截图(10分)
    • 运行TestBanking文件并截图(1分)
  3. Step 6 - PR2文件夹

    • Bank类实现代码或代码截图(10分)
    • CustomerReport类实现代码或代码截图(10分)
    • 运行TestBanking文件并截图(2分)

思考题

  1. 思考如何对ArrayList定义的Account集合排序,按照账户的余额由小到大排列?请描述实现思想或关键语句。

  2. 归纳单例模式的设计原理,思考为什么属性和方法为static?构造函数为private?

实验3 - 接口实现与异常处理

实验题

  1. Step 6文件夹

    • sortCustomers方法实现代码或代码截图(10分)
    • searchCustomers方法实现代码或代码截图(5分)
    • compareTo方法实现代码或代码截图(10分)
    • CustomerReport类实现代码或代码截图(5分)
    • 运行TestBanking文件并截图(5分)
  2. Step 7文件夹

    • OverdraftException类实现代码或代码截图(15分)
    • Account类的withdraw方法实现代码或代码截图(5分)
    • CheckingAccount类的withdraw方法实现代码或代码截图(5分)
    • 运行TestBanking文件并截图(5分)

思考题

  1. 该程序编译后生成几个class文件?

  2. 创建一个类Bird(鸟),给出其声音特征,并在主类中创建一个Bird类的实例,输出其特征。

  3. 如何编写抽象类代替程序中的接口,实现程序同样的功能。试比较它们的不同。

实验4 - GUI程序设计与I/O文件处理

实验题

  1. 创建一个java工程,导入AddressBook.java 和FixedLengthStringIO.java文件,编译运行,运行结果截图(10分)

  2. Step 8

    • 新建banking.DAO 包,在该包中导入FixedLengthStringIO.java、新建CustomerDAO.java。CustomerDAO类封装了Customer文件访问的所有方法。CustomerDAO类实现代码或代码截图。(20分)
    • 修改Bank类,调用CustomerDAO类的方法,使其支持从文件读取客户或保存客户至文件。Bank类实现代码或代码截图。(20分)
    • 新建banking.UI 包,新建MainWindow.java, 调用Bank类的方法,处理界面组件的显示及相应按钮事件。MainWindow类实现代码或代码截图。(20分)
    • 运行MainWindow文件,增加客户,删除客户,搜索客户,客户排序的界面截图。(20分)
      • 增加客户:
      • 删除客户:
      • 搜索客户:
      • 客户排序(用姓氏排):

About

本项目是华南理工大学软件学院的Java语言程序设计实验报告,涵盖了Java运行环境配置、面向对象编程技术、接口实现与异常处理、以及GUI程序设计与I/O文件处理等实验内容。通过一系列实验步骤,学生将掌握Java编程的基本技能和高级特性。

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages