Skip to content

jerrymakesjelly/java-homework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java Homework

Size

It is just a backup of my Java homework. Thanks to my Java teacher Jie LI. 😄

Contents

Homework 1: Class and Array

Simple.

Homework 2: Exception

Defined two exception classes named ScoreException, StudentNumberException based on the homework 1. Throw exceptions when the input is invalid.

Homework 3: Inheritance and Polymorphism(多态)

Use inheritance to define the following 5 classes:

pic1

Homework 4: Collection(群体对象)

Based on the homework 3, defined a class named factory and save all the employees into its HashMap.

Homework 5: GUI

Designed a graphic user interface to input the employee and calculate their average salary information based on the homework 3.

pic2

Homework 6: Design Pattern Practice 1(Singleton Pattern, Factory Pattern and Strategy Pattern)

Designed an online shopping system(actually it's not online). The relations of the classes in the system is shown below.

pic3

Homework 7: Design Pattern Practice 2 (More complex)

Use Singleton Pattern, Factory Pattern, Strategy Pattern, Composite Pattern, Observer Pattern to build a online shopping system, and use Swing to design a graphic user interface for it.

In the end, this is my class diagram which is generated by Eclipse Java Oxygen:

pic4

And these is the screenshot of my online shopping system, which is recorded by ScreenToGif:

pic5

It's really fun!

Compile and Run

Note that you may fail to compile due to encoding. If you encouter encoding problems, please add the parameter -encoding UTF-8.

Homework 1

javac StudentTest.java
java StudentTest
javac StudentListTest.java
java StudentListTest

Homework 2

javac StudentTest.java
java StudentTest

Homework 3 and 4

javac Main.java
java Main

Homework 5

javac MainWindow.java
java MainWindow

Homework 6

javac Sale.java
java Sale

It's a simple version of Homework 7. It just output the total price.

Homework 7

javac MainUI.java
java MainUI

Documentation

All the 7 problems are in the docs folder.

About

Java Homework

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages