首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
代写CS9053、代做Java语言编程
项目预算:
开发周期:
发布时间:
要求地区:
Introduction to Java
CS9053 Section I2
Wednesday 6:00 PM – 8:30 PM
Prof. Dean Christakos
Feb 8th, 2024
Due: Feb 15th, 2024 11:59 PM
Part I – Creating Objects
1.Square pyramid: In the lecture you have seen the creation of a circle. Here you are going to create a square pyramid. A square pyramid has a square base. It has base, a, and a height, H.
The Volume of a Pyramid is given by
l is known at the “slant” and is given by
The surface area of a square pyramid is given by
You will create a class SquarePyramid using the following UML:
In standard UML parlance, “+” indicates that a field or method is public and “-“ indicates that a field or method is private. An underlined field or method indicates it is static.
Every time you create a new SquarePyramid instance, it should have a new sequential id, based on the value of nextId, which should be incremented every time you create a new SquarePyramid instance.
2.Objects and Arrays of Objects
Your objective is to develop the Hero and Party class and to use their methods. The classes are described below to guide you.
Hero
The Hero class contains data related to a hero in a video game. Implement the class according to the following UML diagram:
Hero
Data fields
-name : String
-role: String
-level: int
-experience: int
-MAX_LEVEL: int
-ROLES: String[]
Name of the Hero
Role of the Hero
Contains the level of the Hero
Contains the experience of the Hero
Constant static int containing the max level of 100.
The possible roles: “Warrior”, “Priest”, “Wizard”, “Thief” (ie, a static, pre-defined array of Strings)
Methods
+Hero (name: String)
+setRole(role: String)
+getters for each non-static field
+expToLevelUp()
:int
+gainExperience(experience: int)
+toString()
:String Set the name to given value, set role to “Unassigned”, set level to 1, and experience to 0.
Set the role of the Hero. If the role is not one of the allowed roles, print “Invalid role” and set the role to “Unassigned”.
Get the name, role, level, or experience.
Return the amount of experience necessary to advance to the next level. The formula is level2. For example, at level 6, this should return 62 = 36. This is a helper method for the gainExperience method.
Increase the experience of the Hero. If the experience reaches or passes the maximum for the Hero’s current level, increase the level by 1 by “consuming” the necessary experience.
For example, at level 4 with 20 experience, the Hero should level up to 5 with 4 experience remaining. When a Hero levels up, print “
is now level
!” The max level is 100.
Note: If enough experience is gained at once, the Hero will level up more than once. For example, a level 3 hero receiving 75 experience will level up to 6 with
(75 – 9 – 16 – 25) = 25 experience remaining.
Return a String containing the information about the hero:
Template:
“
the
is level
with
experience.”
Example:
“Hagrid the Wizard is level 55 with 120 experience.”
Party
The Party class contains an array of Hero‘s that are in the party.
Implement the class according to the following UML diagram:
Party
Data fields
-heroes: Hero[3]
Array of Hero’s in the current party.
Methods
+Party()
+addHero( hero: Hero, index: int)
+removeHero(index: int)
+getHero(index: int)
:Hero
+gainExperience(experience: int)
+toString()
:String Initialize the Hero array to hold 3 Hero’s. Initialize each element to null.
Add a Hero to the current party at the given index. If there is an existing Hero at the index, replace it. If the hero is already in the party, print “
is already in the party.”
Remove the Hero from the given index (to “remove” from the array, set the array element to null and shift any other elements to the left, so that the only nulls are at the end of the array).
Return the Hero of the desired index.
Prints “The party gained
experience.”
Increase the experience of all the Hero’s in the Party.
Hint: Use each Hero’s gainExperience method.
Return a String containing the information about the hero.
Template:
“Party:
the
is level
with
experience.
the
is level
with
experience.
the
is level
with
experience.
“
Example:
“Party:
Thor the Warrior is level 10 with 4 experience.
Groot the Thief is level 20 with 19 experience.
Doctor Strange the Wizard is level 5 with 1 experience.“
Note: Only print assigned party members (Do not print anything if any heroes elements are null).
Hint: Use each Hero’s toString method.
After implementing this, create three heroes with names and roles of your choice, add them to the party, and give the party 100 experience points. Then print out the party by calling the toString() method for the party and passing it to System.out.println()
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
代做 program、代写 c++设计程...
2024-12-23
comp2012j 代写、代做 java 设...
2024-12-23
代做 data 编程、代写 python/...
2024-12-23
代做en.553.413-613 applied s...
2024-12-23
代做steady-state analvsis代做...
2024-12-23
代写photo essay of a deciduo...
2024-12-23
代写gpa analyzer调试c/c++语言
2024-12-23
代做comp 330 (fall 2024): as...
2024-12-23
代写pstat 160a fall 2024 - a...
2024-12-23
代做pstat 160a: stochastic p...
2024-12-23
代做7ssgn110 environmental d...
2024-12-23
代做compsci 4039 programming...
2024-12-23
代做lab exercise 8: dictiona...
2024-12-23
热点标签
mktg2509
csci 2600
38170
lng302
csse3010
phas3226
77938
arch1162
engn4536/engn6536
acx5903
comp151101
phl245
cse12
comp9312
stat3016/6016
phas0038
comp2140
6qqmb312
xjco3011
rest0005
ematm0051
5qqmn219
lubs5062m
eee8155
cege0100
eap033
artd1109
mat246
etc3430
ecmm462
mis102
inft6800
ddes9903
comp6521
comp9517
comp3331/9331
comp4337
comp6008
comp9414
bu.231.790.81
man00150m
csb352h
math1041
eengm4100
isys1002
08
6057cem
mktg3504
mthm036
mtrx1701
mth3241
eeee3086
cmp-7038b
cmp-7000a
ints4010
econ2151
infs5710
fins5516
fin3309
fins5510
gsoe9340
math2007
math2036
soee5010
mark3088
infs3605
elec9714
comp2271
ma214
comp2211
infs3604
600426
sit254
acct3091
bbt405
msin0116
com107/com113
mark5826
sit120
comp9021
eco2101
eeen40700
cs253
ece3114
ecmm447
chns3000
math377
itd102
comp9444
comp(2041|9044)
econ0060
econ7230
mgt001371
ecs-323
cs6250
mgdi60012
mdia2012
comm221001
comm5000
ma1008
engl642
econ241
com333
math367
mis201
nbs-7041x
meek16104
econ2003
comm1190
mbas902
comp-1027
dpst1091
comp7315
eppd1033
m06
ee3025
msci231
bb113/bbs1063
fc709
comp3425
comp9417
econ42915
cb9101
math1102e
chme0017
fc307
mkt60104
5522usst
litr1-uc6201.200
ee1102
cosc2803
math39512
omp9727
int2067/int5051
bsb151
mgt253
fc021
babs2202
mis2002s
phya21
18-213
cege0012
mdia1002
math38032
mech5125
07
cisc102
mgx3110
cs240
11175
fin3020s
eco3420
ictten622
comp9727
cpt111
de114102d
mgm320h5s
bafi1019
math21112
efim20036
mn-3503
fins5568
110.807
bcpm000028
info6030
bma0092
bcpm0054
math20212
ce335
cs365
cenv6141
ftec5580
math2010
ec3450
comm1170
ecmt1010
csci-ua.0480-003
econ12-200
ib3960
ectb60h3f
cs247—assignment
tk3163
ics3u
ib3j80
comp20008
comp9334
eppd1063
acct2343
cct109
isys1055/3412
math350-real
math2014
eec180
stat141b
econ2101
msinm014/msing014/msing014b
fit2004
comp643
bu1002
cm2030
联系我们
- QQ: 9951568
© 2021
www.rj363.com
软件定制开发网!