IT114105 Contemporary Topics in Software


Module Name: Contemporary Topics in Software Engineering
Module Code: ITP4507
Assignment Number: One
Hand-in: Friday 15 November, 2024 (On or before 4:30 PM to Moodle)
Weighting of This Assignment: 66.67% of the End of Module Assessment
This assignment must be done by individual only. Plagiarism will be treated seriously. 
Any assignments that are found involved wholly or partly in plagiarism 
(no matter the assignments are from the original authors or from the plagiarists) 
will score Zero mark. Late submission will NOT be accepted.
Task Specification
Snow Storm Company develops an RPG game "Fantastic World (FW)" on the PC. The major characters in 
this game are known as HERO and they have various kinds of characteristic. For example, Warrior focus on 
defence and Warlock target on magic damage. Each player in this game can play more than one hero.
Currently, this game only has Warrior and Warlock. In the coming future, this game will be extended to 
support more kinds of hero such as healer. The following is the simplified class diagram of existing data 
maintained by FW.
P a g e | 2
As a system analyst of the Company, you are required to design and develop FW. You can get the source 
codes of above classes from Moodle.
FW should provide the following functions:
1. Create a Player.
2. Add a hero (Warrior or Warlock) to the current player.
3. Remove a hero from the current player.
4. Select a player by using a player ID.
5. Call a hero's skill by a hero ID.
6. Show the detail information of current player.
7. Change the player's name of the current player.
8. Show all players.
9. Set current player.
10. Undo last command.
11. Redo the last undone command.
12. Show undo/redo list.
13. Exit System.
Your system design should conform to the Open Closed Principle so that your design should easily be 
extended to support new heroes (for examples, healers, rangers etc..).
You MUST apply the following design patterns for your new system
 Command pattern to provide the “create player”, “set current player”, “add hero”, 
“call hero skill”, “delete hero”, “show current player”, “display all players”, “change player’s 
name”. “undo”, “redo” and “show undo/redo list” functions 
 Factory pattern or Abstract Factory Pattern to create different kinds of Command objects and 
different kinds of Player/Hero objects (e.g., Warrior object, Warlock object, Player object, etc.)
 Memento pattern to provide “Undo” and “Redo” functions on the “call hero skill” and “change 
player’s name” functions.
Assignment Report 
In addition to the system development, you are required to write up a Short Report covers the following 
sections:
 1. Assumptions regarding the problem context
 2. Application design with class diagram
 3. Discussion and explanation on each of the design patterns applied to the application
 4. Test Plan and Test Cases
 5. Well documented Source Code
P a g e | 3
Mark Allocation
Your assignment work will be marked according to the following criteria.
Work Mark Allocated
System Coding and Implementation
a) Implementation of the system and coding style
(Hard-coded output will result in zero mark.)
30%
b) Correctness of system functions *
(Hard-coded output will result in zero mark.)
15%
c) Test Plan and Test Cases
(Will be used in testing your own application.) 
10%
System Analysis and Design, and Discussion
d) Design of your system and correct use of design patterns 20%
e) Application design with class diagram 10%
f) Discussion and explanation on each of the design patterns 
applied to the application
15%
Total 100%
Note: * Please note that your source code will be recompiled and tested for the correctness of the system 
functions. Your implementation is required to support the 'Copy and Paste' method for testing which is 
described in page 16.
Submission of Assignment Work
1. The front page of your submission should include the programme title(code), module title(code), and 
student number and student name.
2. Submit your Java source code and your report to https://moodle.vtc.edu.hk .
 Well documented Source Code of your program.
 Report for analysis, design, discussion, user guide, test plan and test cases of your following work.
A. The assumption made during analysis and design of the application
B. System design on your application with class diagram 
C. Discussion on the design patterns that applied on your program
D. Test Plan with Test Cases (Design your own test plan and corresponding test cases for each 
function. For each test case, you should provide a SCREEN CAPTURE for test result).
3. Submit according to the guideline on the top part of cover page. Late submission will NOT be 
accepted.
P a g e | 4
Extra Reference: Sample Test
Testing Method
This sample run is served for reference only. You are free to design your own user interface. But to make 
the testing environment simple and to apply the "Copy and Paste" testing method described on page 16
easily, you are advised to accept user input at the command prompt as shown in the sample run below.
Sample Run of assignment
You may follow the design of user interface shown in this sample run in DOS command prompt. 
For following examples, character(s) with underline is user's input.
1. Create player
Fantastic World (FW)
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-c
Player ID:- P001
Player Name:- Thomas Yiu
Player Thomas Yiu is created.
Current player is changed to P001.
2. Add heroes to the player
Fantastic World (FW)
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P001 Thomas Yiu.
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-a
Please input hero information (id, name):- H001, peter pang
Hero Type (1 = Warrior | 2 = Warlock ):- 1
Hero is added.
Fantastic World (FW)
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P001 Thomas Yiu.
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-a
P a g e | 5
Please input hero information (id, name):- H002, john wick
Hero Type (1 = Warrior | 2 = Warlock ):- 2
Hero is added.
3. Show the current player
Fantastic World (FW)
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P001 Thomas Yiu.
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-s
Player Thomas Yiu (P001)
Heroes:
H001, peter pang, Warrior, Hp: 500, Damage: 0, Defence Point: 500
H002, john wick, Warlock, Hp: 100, Damage: 200, Mp: 500
4. Create another player and display all players
Fantastic World (FW)
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P001 Thomas Yiu.
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-c
Player ID:- P002
Player Name:- Stan Lee
Player Stan Lee is created.
Current player is changed to P002.
Fantastic World (FW)
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P002 Stan Lee.
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-p
Player Thomas Yiu (P001)
Player Stan Lee (P002)
P a g e | 6
5. Add heroes to the player P002
Fantastic World (FW)
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P002 Stan Lee.
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-a
Please input hero information (id, name):- H003, scarlet witch
Hero Type (1 = Warrior | 2 = Warlock ):- 2
Hero is added.
Fantastic World (FW)
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P002 Stan Lee
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-a
Please input hero information (id, name):- H004, tony stark
Hero Type (1 = Warrior | 2 = Warlock ):- 1
Hero is added.
6. Show the current player
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P002 Stan Lee.
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-s
Player Stan Lee (P002)
Heroes:
H003, scarlet witch, Warlock, Hp: 100, Damage: 200, Mp: 500
H004, tony stark, Warrior, Hp: 500, Damage: 0, Defence Point: 500
7. Set the current player by Player ID
Fantastic World (FW)
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P002 Stan Lee.
P a g e | 7
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-g
Please input player ID:- P001
Changed current player to P001. 
10. Call hero skill
Fantastic World (FW)
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P001 Thomas Yiu.
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-m
Please input hero ID:- H001
H001 peter pang’s attributes are changed to:
H001, peter pang, Hp: 500, Damage: 250, Defence Point: 400
Fantastic World (FW)
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P001 Thomas Yiu.
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-s
Player Thomas Yiu (P001)
Heroes:
H001, peter pang, Warrior, Hp: 500, Damage: 250, Defence Point: 400
H002, john wick, Warlock, Hp: 100, Damage: 200, Mp: 500
11. Delete hero
Fantastic World (FW)
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P001 Thomas Yiu.
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-d
Please input hero ID:- H002
H002 john wick is deleted.
P a g e | 8
12. Change the name of the current player
Fantastic World (FW)
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P001 Thomas Yiu.
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-t
Please input new name of the current player:- Russo Brothers
Player’s name is updated.
Fantastic World (FW)
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P001 Russo Brothers.
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-s
Player Russo Brothers (P001)
Heroes:
H001, peter pang, Warrior, Hp: 500, Damage: 250, Defence Point: 400
13. Show undo/redo list
Fantastic World (FW)
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P001 Russo Brothers.
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-l
Undo List
Change player’s name, P001, Russo Brothers
Delete hero, H002
Call hero skill, H001, peter pang, Warrior, Hp: 500, Damage: 250, Defence 
Point: 400
Add hero, H004, tony stark, Warrior
Add hero, H003, scarlet witch, Warlock
Create player, P002, Stan Lee
Add hero, H002, john wick, Warlock
Add hero, H001, peter pang, Warrior
P a g e | 9
Create player, P001, Thomas Yiu
-- End of undo list --
Redo List
-- End of redo list –
14. UNDO actions in UNDO list
Fantastic World (FW)
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P001 Russo Brothers.
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-u
Command (Change player’s name, P001, Russo Brothers) is undone.
Fantastic World (FW)
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P001 Thomas Yiu.
Fantastic World (FW)
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P001 Thomas Yiu.
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-u
Command (Delete hero, H002) is undone.
Fantastic World (FW)
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P001 Thomas Yiu.
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-u
Command (Call hero skill, H001, peter pang, Warrior, Hp: 500, Damage: 250, 
Defence Point: 400) is undone.
P a g e | 10
Fantastic World (FW)
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P001 Thomas Yiu.
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-s
Player Thomas Yiu (P001)
Heroes:
H001, peter pang, Warrior, Hp: 500, Damage: 0, Defence Point: 500
H002, john wick, Warlock, Hp: 100, Damage: 200, Mp: 500
Fantastic World (FW)
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P001 Thomas Yiu.
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-u
Command (Add hero, H004, tony stark, Warrior) is undone.
Fantastic World (FW)
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P001 Thomas Yiu.
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-u
Command (Add hero, H003, scarlet witch, Warlock) is undone.
Fantastic World (FW)
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P001 Thomas Yiu.
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-g
Please input player ID:- P002
Changed current player to P002.
P a g e | 11
Fantastic World (FW)
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P002 Stan Lee.
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-s
Player Stan Lee (P002)
Heroes:
Fantastic World (FW)
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P002 Stan Lee.
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-u
Command (Create player, P002, Stan Lee) is undone.
Current player is changed to P001.
Fantastic World (FW)
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P001 Thomas Yiu.
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-g
Please input player ID:- P002
Player P002 is not found!!
Fantastic World (FW)
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P001 Thomas Yiu.
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-l
Undo List
Add hero, H002, john wick, Warlock
Add hero, H001, peter pang, Warrior
Create player, P001, Thomas Yiu
-- End of undo list --
P a g e | 12
Redo List
Create player, P002, Stan Lee
Add hero, H003, scarlet witch, Warlock
Add hero, H004, tony stark, Warrior
Call hero skill, H001, peter pang, Warrior, Hp: 1000, Damage: 500, Defence 
Point: 400
Delete hero, H002
Change player’s name, P001, Russo Brothers
-- End of redo list –
15. REDO actions in REDO list
Fantastic World (FW)
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P001 Thomas Yiu.
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-r
Command (Create player, P002, Stan Lee) is redone. 
The current player is changed to P002.
Fantastic World (FW)
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P002 Stan Lee.
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-r
Command (Add hero, H003, scarlet witch, Warlock) is redone. 
Fantastic World (FW)
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P002 Stan Lee.
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-r
Command (Add hero, H004, tony stark, Warrior) is redone.
Fantastic World (FW)
P a g e | 13
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P002 Stan Lee.
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-s
Player Stan Lee (P002)
Heroes:
H003, scarlet witch, Warlock, Hp: 100, Damage: 200, Mp: 500
H004, tony stark, Warrior, Hp: 500, Damage: 0, Defence Point: 500
Fantastic World (FW)
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P002 Stan Lee.
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-r
Command (Call hero skill, H001, peter pang, Warrior, Hp: 500, Damage: 250, 
Defence Point: 400) is redone. 
Fantastic World (FW)
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P001 Thomas Yiu.
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-g
Please input player ID:- P001
Changed current player to P001.
Fantastic World (FW)
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P001 Russo Brothers.
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-s
Player Russo Brothers (P001)
Heroes:
H001, peter pang, Warrior, Hp: 500, Damage: 250, Defence Point: 400
H002, john wick, Warlock, Hp: 100, Damage: 200, Mp: 500
P a g e | 14
Fantastic World (FW)
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P002 Stan Lee.
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-l
Undo List
Call hero skill, H001, peter pang, Warrior, Hp: 1000, Damage: 500, Defence 
Point: 400
Add hero, H004, tony stark, Warrior 
Add hero, H003, scarlet witch, Warlock 
Create player, P002, Stan Lee
Add hero, H002, john wick, Warlock
Add hero, H001, peter pang, Warrior
Create player, P001, Thomas Yiu
-- End of undo list --
Redo List
Delete hero, H002
Change player’s name, P001, Russo Brothers
-- End of redo list –
- END OF SAMPLE TEST –
P a g e | 15
You can ease the testing by using the 'Copy and Paste' method rather than inputting data manually. Prepare a text file, 
which includes all user inputs in a test run. By using the 'Copy and Paste' method, you can automatically input in the 
command prompt window and then get the result automatically (without the input data echoed). The following is an 
example of the text file for user inputs. 
Sample User Inputs for a Test Run
c
P001
Thomas Yiu
a
H001, peter pang
1
a
H002, john wick
2
s
c
P002
Stan Lee
p
a
H003, scarlet witch
a
H004, tony stark
1
s
g
P001
m
H001
s
d
H002
t
Russo Brothers
s
l
u
u
u
s
u
u
g
P002
s
u
g
P002
l
r
r
r
s
P a g e | 16
r
g
P001
s
l
x
Expected Output of the Test Run
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system 
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :Player 
ID:- Player Name:-
Player Thomas Yiu is created. 
Current player is changed to P001. 
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system 
The current player is P001 Thomas Yiu. 
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-
Please input hero information (id, name):- Hero Type (1 = Warrior | 2 = Warlock 
):- 
Hero is added. 
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system 
The current player is P001 Thomas Yiu. 
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-Please 
input hero information (id, name):- Hero Type (1 = Warrior | 2 = Warlock ):-
Hero is added. 
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system 
The current player is P001 Thomas Yiu. 
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-Player 
Thomas Yiu (P001) 
Heroes: 
H001, peter pang, Warrior, Hp: 500, Damage: 0, Defence Point: 500 
H002, john wick, Warlock, Hp: 100, Damage: 200, Mp: 500 
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system 
The current player is P001 Thomas Yiu. 
P a g e | 17
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-Player 
ID:- Player Name:- 
Player Stan Lee is created. 
Current player is changed to P002. 
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system
The current player is P002 Stan Lee. 
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-Player 
Thomas Yiu (P001) 
Player Stan Lee (P002) 
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system 
The current player is P002 Stan Lee. 
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-Please 
input hero information (id, name):- H003, scarlet witch 
Hero Type (1 = Warrior | 2 = Warlock ):- 2 
Hero is added. 
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system 
The current player is P002 Silent Hill. 
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-
aPlease input hero information (id, name):- H004, tony stark 
Hero Type (1 = Warrior | 2 = Warlock ):- 1 
Hero is added. 
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system 
The current player is P002 Stan Lee. 
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-Player 
Stan Lee (P002) 
Heroes: 
H003, scarlet witch, Warlock, Hp: 100, Damage: 200, Mp: 500 
H004, tony stark, Warrior, Hp: 500, Damage: 0, Defence Point: 500 
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system 
The current player is P002 Stan Lee.
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-Please 
input player ID:- P001 
Changed current player to P001. 
P a g e | 18
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system 
The current player is P001 Thomas Yiu. 
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-Please 
input hero ID:- H001 
H001 peter pang’s attributes are changed to: 
H001, peter pang, Hp: 500, Damage: 250, Defence Point: 400 
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system 
The current player is P001 Thomas Yiu. 
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-Player 
Thomas Yiu (P001) 
Heroes: 
H001, peter pang, Warrior, Hp: 500, Damage: 250, Defence Point: 400 
H002, john wick, Warlock, Hp: 100, Damage: 200, Mp: 500 
11. Delete hero 
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system 
The current player is P001 Thomas Yiu. 
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-Please 
input hero ID:- H002 
H002 john wick is deleted. 
12. Change the name of the current player 
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system 
The current player is P001 Thomas Yiu. 
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-Please 
input new name of the current player:- Russo Brothers
Player’s name is updated. 
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system 
The current player is P001 Russo Brothers. 
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-Player 
Russo Brothers (P001) 
Heroes: 
H001, peter pang, Warrior, Hp: 500, Damage: 250, Defence Point: 400 
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system 
P a g e | 19
The current player is P001 Russo Brothers. 
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-Undo 
List 
Change player’s name, P001, Russo Brothers
Delete hero, H002 
Call hero skill, H001, peter pang, Warrior, Hp: 1000, Damage: 500, Defence 
Point: 400 
Add hero, H004, tony stark, Warrior 
Add hero, H003, scarlet witch, Warlock 
Create player, P002, Stan Lee 
Add hero, H002, john wick, Warlock 
Add hero, H001, peter pang, Warrior 
Create player, P001, Thomas Yiu 
-- End of undo list --
Redo List 
-- End of redo list –
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system 
The current player is P001 Russo Brothers. 
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :Command 
(Change player’s name, P001, Russo Brothers) is undone. 
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system 
The current player is P001 Thomas Yiu. 
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system 
The current player is P001 Thomas Yiu. 
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-
Command (Delete hero, H002) is undone. 
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system 
The current player is P001 Thomas Yiu. 
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-
Command (Call hero skill, H001, peter pang, Warrior, Hp: 500, Damage: 250, 
Defence Point: 400) is undone. 
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system 
The current player is P001 Thomas Yiu. 
P a g e | 20
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-Player 
Thomas Yiu (P001) 
Heroes: 
H001, peter pang, Warrior, Hp: 500, Damage: 0, Defence Point: 500 
H002, john wick, Warlock, Hp: 100, Damage: 200, Mp: 500 
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system 
The current player is P001 Thomas Yiu. 
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-
Command (Add hero, H004, tony stark, Warrior) is undone. 
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system 
The current player is P001 Thomas Yiu. 
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-
Command (Add hero, H003, scarlet witch, Warlock) is undone. 
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system 
The current player is P001 Thomas Yiu. 
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-Please 
input player ID:- P002 
Changed current player to P002. 
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system 
The current player is P002 Stan Lee. 
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-Player 
Stan Lee (P002) 
Heroes: 
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system 
The current player is P002 Stan Lee. 
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-
Command (Create player, P002, Stan Lee) is undone. 
Current player is changed to P001. 
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system 
The current player is P001 Thomas Yiu. 
P a g e | 21
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-Please 
input player ID:- P002 
Player P002 is not found!! 
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system 
The current player is P001 Thomas Yiu. 
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-Undo 
List 
Add hero, H002, john wick, Warlock 
Add hero, H001, peter pang, Warrior 
Create player, P001, Thomas Yiu 
-- End of undo list --
Redo List 
Create player, P002, Stan Lee 
Add hero, H003, scarlet witch, Warlock 
Add hero, H004, tony stark, Warrior 
Call hero skill, H001, peter pang, Warrior, Hp: 500, Damage: 250, Defence 
Point: 400 
Delete hero, H002 
Change player’s name, P001, Russo Brothers
-- End of redo list –
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system 
The current player is P001 Thomas Yiu. 
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-
Command (Create player, P002, Stan Lee) is redone. 
The current player is changed to P002. 
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system 
The current player is P002 Stan Lee. 
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-
Command (Add hero, H003, scarlet witch, Warlock) is redone. 
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system 
The current player is P002 Stan Lee. 
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-
Command (Add hero, H004, tony stark, Warrior) is redone. 
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system 
P a g e | 22
The current player is P002 Stan Lee.
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-
Player Stan Lee (P002) 
Heroes: 
H003, scarlet witch, Warlock, Hp: 100, Damage: 200, Mp: 500 
H004, tony stark, Warrior, Hp: 500, Damage: 0, Defence Point: 500 
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system 
The current player is P002 Stan Lee. 
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-
Command (Call hero skill, H001, peter pang, Warrior, Hp: 500, Damage: 250, 
Defence Point: 400) is redone. 
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system 
The current player is P001 Thomas Yiu. 
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-Please 
input player ID:- P001 
Changed current player to P001. 
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d 
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system 
The current player is P001 Russo Brothers. 
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-Player 
Russo Brothers (P001) 
Heroes: 
H001, peter pang, Warrior, Hp: 500, Damage: 250, Defence Point: 400 
H002, john wick, Warlock, Hp: 100, Damage: 200, Mp: 500
Fantastic World (FW) 
c = create player, g = set current player, a = add hero, m = call hero skill, d
= delete hero, s = show player, p = display all players, t = change player’s 
name, u = undo, r = redo, l = list undo/redo, x = exit system 
The current player is P002 Stan Lee. 
Please enter command [ c | g | a | m | d | s | p | t | u | r | l | x ] :-Undo
List 
Call hero skill, H001, peter pang, Warrior, Hp: 500, Damage: 250, Defence 
Point: 400 
Add hero, H004, tony stark, Warrior 
Add hero, H003, scarlet witch, Warlock 
Create player, P002, Stan Lee 
Add hero, H002, john wick, Warlock 
Add hero, H001, peter pang, Warrior 
Create player, P001, Thomas Yiu 
-- End of undo list --
Redo List 
Delete hero, H002 
P a g e | 23
Change player’s name, P001, Russo Brothers
-- End of redo list –
P a g e | 24
Requirement for Scanner usage
Wrong Scanner usage (more than one object of Scanner is created for reading keyboard input):
// create new Scanner objects in loop
do {
Scanner sc = new Scanner( System.in); 
choice = sc.nextInt();
} while (choice != 1);
Correct Scanner usage (only one Scanner object is created for reading keyword input):
Following is an example program to use a Global Scanner object or pass as a parameter to do the input.
import java.util.Scanner;
public class Test {
 //Global declaration for Scanner
 public static Scanner sc = new Scanner(System.in);
 public static void main(String args[]) {
 int x;
 System.out.print("Enter x:");
 x = sc.nextInt();
 }
 public static void method1() {
 int y;
 System.out.print("Enter y:");
 y = sc.nextInt();
 }
 public static void method2(Scanner sc) {
 int y;
 System.out.print("Enter y:");
 y = sc.nextInt();
 }
}
*** END ***

潮汐研究作为海洋科学的关键分支,融合了物理海洋学、地理信息系统及水利工程等多领域知识。TMD2.05.zip是一套基于MATLAB环境开发的潮汐专用分析工具集,为科研人员与工程实践者提供系统化的潮汐建模与计算支持。该工具箱通过模块化设计实现了两大核心功能: 在交互界面设计方面,工具箱构建了图形化操作环境,有效降低了非专业用户的操作门槛。通过预设参数输入模块(涵盖地理坐标、时间序列、测站数据等),用户可自主配置模型运行条件。界面集成数据加载、参数调整、可视化呈现及流程控制等标准化组件,将复杂的数值运算过程转化为可交互的操作流程。 在潮汐预测模块中,工具箱整合了谐波分解法与潮流要素解析法等数学模型。这些算法能够解构潮汐观测数据,识别关键影响要素(包括K1、O1、M2等核心分潮),并生成不同时间尺度的潮汐预报。基于这些模型,研究者可精准推算特定海域的潮位变化周期与振幅特征,为海洋工程建设、港湾规划设计及海洋生态研究提供定量依据。 该工具集在实践中的应用方向包括: - **潮汐动力解析**:通过多站点观测数据比对,揭示区域主导潮汐成分的时空分布规律 - **数值模型构建**:基于历史观测序列建立潮汐动力学模型,实现潮汐现象的数字化重构与预测 - **工程影响量化**:在海岸开发项目中评估人工构筑物对自然潮汐节律的扰动效应 - **极端事件模拟**:建立风暴潮与天文潮耦合模型,提升海洋灾害预警的时空精度 工具箱以"TMD"为主程序包,内含完整的函数库与示例脚本。用户部署后可通过MATLAB平台调用相关模块,参照技术文档完成全流程操作。这套工具集将专业计算能力与人性化操作界面有机结合,形成了从数据输入到成果输出的完整研究链条,显著提升了潮汐研究的工程适用性与科研效率。 资源来源于网络分享,仅用于学习交流使用,请勿用于商业,如有侵权请联系我删除!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值