国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女av在线免费观看

合肥生活安徽新聞合肥交通合肥房產(chǎn)生活服務(wù)合肥教育合肥招聘合肥旅游文化藝術(shù)合肥美食合肥地圖合肥社保合肥醫(yī)院企業(yè)服務(wù)合肥法律

代做AnDe 、代寫Pokemon 程序設(shè)計
代做AnDe 、代寫Pokemon 程序設(shè)計

時間:2024-12-06  來源:合肥網(wǎng)hfw.cc  作者:hfw.cc 我要糾錯



Data Structures: Assignment 2 
Pokemon Unite Friend Tracker 
AnDe 2024 
 
** Introduction 
 
A MOBA recently got released in China called Pokemon Unite. As you enjoy playing various MOBA-style games 
you decide to give it a try. While playing, you’ve decided you want to track your skills and progression in 
comparison to your friends. To accomplish this, you decide to build a back-end system for adding, removing 
and maintaining them. The idea is to organise your friends so that you can search for individuals, search for 
players who play certain Pokemon, determine rankings based on account level and view player information 
and the ribbons they’ve earnt. At the same time, you’d like your search queries to be fast, ruling out basic 
structures like arrays and linked lists. Deciding that the most important factor for ordering your friends is their 
account level, you build a binary search tree (BST) structure, using the level (actually represented via a 
method, see Section 4) as the key. 
 
In this assignment we will build a BST structure, with each node representing a friend. Each friend node 
contains information about that player, including their username and level, along with attached data 
structures for the Pokemon they play (single linked-list) and ribbons (ArrayList). In accordance with the rules of 
BSTs, each friend has a parent node and two child nodes, left and right. From any one node, all nodes to the 
left are less (lower level) and all nodes to the right are greater (higher level). Due to this, searching for higher 
or lower-levelled players is, on average, a O(log n) process. This assignment consists of a number of parts. 
 
• Part A - you will setup the basic class structure, ensuring that the test suite is able to run without 
error. 
• Part B - you will implement the basic structures needed by Account to hold multiple Ribbon and 
Pokemon objects. 
• Part C - you will create your BST-based friend database. 
• Part D - you will improve the efficiency of your tree by implementing AVL balancing. 
 
You are free to add your own methods and fields to any of the classes in the Database package, but do not 
change any existing method prototypes or field definitions. A testing suite has been provided for you to test 
the functionality of your classes. These tests will be used to mark your assignment, but with altered values. 
This means that you cannot hard-code answers to pass the tests. It is suggested that you complete the 
assignment in 1 the order outlined in the following sections. Many of the later-stage classes rely 
on the correct implementation of their dependencies. 
 
Importing into eclipse 
The Assignment has been provided as an eclipse project. You just need to import the project into an existing 
workspace.  
 
 
 Make sure that your Java JDK has been set, as well as the two jar files that you need for junit to function. This 
can be found in: 
 
Project -> Properties -> Java -> Build Path -> Libraries. 
 
You might have to add the JAR files to the Classpath (see figure below). The jar files have been provided within 
the project; there is no need to download any other version and doing so may impact the testing environment. 
 
2 Part A 
If you run the testing suite, you will be lovingly presented with many errors. Your first task is to complete the 
class implementations that the tests expect (including instance variables and basic methods) to remove all 
errors from the testing classes. 
 
2.1 Pokemon 
The Pokemon class represents one playable Pokemon and includes general information: the name, role 
(represented as an enum: speedster, all-rounder, attacker, defender, supporter) and number of obtainable 
ribbons. In addition, it holds a reference to another Pokemon object. This will be important 
in section 3 where you will make a single-linked list of Pokemon. The Pokemon class requires the following 
instance variables: 
 
public enum Role { 
SPEEDSTER, ALLROUNDER, ATTACKER, DEFENDER, SUPPORTER 

 
private String name; 
private Role role; 
private Pokemon next; 
 
 
The toString method should output a string in the following format: 
 
Absol, Role: SPEEDSTER 
 
You should also generate the appropriate accessor and mutator methods. 
 
 
Test Marks 
testConstructor 2 
toStringTest 3 
Total: 5 
 
2.2 Ribbon 
The Ribbon class represents an achievement level. This includes information about the name, rarity and the 
date it was obtained. The rarity can only be from a set of finite options available through enumerator 
variables. The Ribbon class requires the following instance variables: 
 
public enum Rarity { 
GREEN, BLUE, GOLD 

 
private String name; 
private Rarity rarity; 
private Calendar obtained; 
private Pokemon pokemon; 
 
The toString method should output a string in the following format (quotation marks included): 
 “Pursuited”, rarity: GOLD, obtained on: May 04, 2024 
 
Hint: A printed Calendar object may not look as you might expect. Take a look at APIs for java date formatters. 
 
You should also generate the appropriate accessor and mutator methods. PokemonTester will assign marks as 
shown below: 
 
Test Marks 
testConstructor 2 
toStringTest 3 
Total: 5 
 
2.3 Account 
The Account class represents a user and, more generally, a tree node. Most importantly when using as a tree 
node, the class must have a key on which the tree can be ordered. In our case, it is a double named key. This 
key is a simple function based on the combination of a user's username and level. As levels are whole numbers 
and likely not unique, a simple method (see calculateKey snippet below) is used to combine the two values 
into one key whilst preserving the level. For example, imagine that the hashcode for username “abc” is 1234 
and the user's level is 3. We do not want to simply add the hash to the level as that would not preserve the 
level and would lead to incorrect rankings. Instead, we calculate 1234=10000 to get 0:1234. This can then be 
added to the level. As the usernames must be unique, our node keys are now also unique and the user level is 
preserved. 
A string's hash value can never be guaranteed to be unique, but for the purposes of this assignment we will assume them to be. 
 
private double calculateKey() { 
int hash = Math.abs(username.hashCode()); 
// Calculate number of zeros we need 
int length = (int)(Math.log10(hash) + 1); 

// Make a divisor 10^length 
double divisor = Math.pow(10, length); 
// Return level.hash 
return level + hash / divisor; 

 
 
The Account class requires the following instance variables: 
private String username; 
private int level; 
private double key; 
private ArrayList<Ribbon> ribbons; 
private PokemonList pokemon; 
private Account left; 
private Account right; 

An ArrayList type was chosen for variable ribbons as you figured it would be easier to add a new ribbon to a list 
than a standard array, and you probably would mostly just traverse the list in order. A PokemonList object (see section 3) was chosen as the structure for storing owned Pokemon as a custom single linked-list is more 
appropriate for writing reusable methods. 
 
The toString method should output a string in the following format: 
 
User: Harry 
 
Ribbons: 
"Snow Warning", rarity: BLUE, obtained on: Mar 26, 2024 
"Sacred Sword", rarity: GREEN, obtained on: Mar 26, 2014 
 
Pokemon Owned: 
Ninetales, Role: ATTACKER 
Absol, Role: SPEEDSTER 
Aegislash, Role: ALLROUNDER 
Tyranitar, Role: ALLROUNDER 
Charizard, Role: ALLROUNDER 
 
You should also generate the appropriate accessor and mutator methods. 
AccountTester will assign marks as shown below: 
 
Test Marks 
testConstructor 2 
toStringTest 3 
Total: 5 
 
3 Part B 
In this section you will complete the PokemonList single linked-list for storing playable Pokemon objects. 
 
3.1 PokemonList 
The PokemonList class provides a set of methods used to find Pokemon objects that have been linked to form 
a single-linked list as shown in the image below. The head is a reference to the first Pokemon node, and each 
Pokemon stores a reference to the next Pokemon, or null if the Pokemon is at the end. 
 
The PokemonList class requires only one instance variable: 
public Pokemon head 
 
There are a number of methods that you must complete to receive marks for this section. They can be 
completed in any order. Your tasks for each method are outlined in the following sections. 
 
3.1.1 void addPokemon(Pokemon pokemon) 
This method should add the provided pokemon to the end of your linked list. It should search for the first 
available slot, and appropriately set the previous pokemon's next variable. All pokemon must be unique, so 
you should check that the same pokemon has not already been added.  
Note that the tests require that the provided Pokemon object is added, not a copy. If the PokemonList head 
variable is null, head should be updated to refer to the new pokemon. If the provided Pokemon object is null, 
an IllegalArgumentException should be thrown. 
 
3.1.2 Pokemon getPokemon(String name) 
getPokemon should traverse the linked list to find a pokemon with a matching name. If the pokemon cannot 
be found, the method should return null. If the name provided is null, the method should throw an 
llegalArgumentException. 
 
3.1.3 void removePokemon(String name) | void removePokemon(Pokemon pokemon) 
There are two overloaded removePokemon methods with one taking as an argument a String, the other a 
Pokemon. Both methods should search the linked list for the target pokemon and remove it from the list. You 
should appropriately set the previous node's next variable or set the head variable, if applicable. Both methods 
should throw an IllegalArgumentException if their argument is null. 
 
 
3.1.4 String toString() 
This method should output a string in the following format: 
 
Ninetales, Role: ATTACKER 
Absol, Role: SPEEDSTER 
 
4 Part C 
In this section you will complete your binary search tree data structure for storing all your friends' information. 
 
Note: To keep things simple, we have limited the Pokemon and Ribbon data structures to preset ones in the 
marker file. In an actual application you would not have these presets made at the start, and instead add them 
as they’re created. 
 
4.1 BinaryTree 
Now that all the extra setup has been completed, it can all be brought together to form your tree structure. 
The BinaryTree class provides a set of methods for forming and altering your tree, and a set of methods for 
querying your tree. The goal is to form a tree that adheres to BST rules, resulting in a structure such as shown 
in Figure 1 below. 
 
Test Marks 
getGameNullArg 1 
getGame 2 
addGame 2 
addGameExists 1 
addGameNullArg 1 
removeGameNullArg 1 
removeGameString 2 
removeGameObject 2 
toStringTest 3 
 
Total: 15  
Figure 1 – initial BST structure 
 
The BinaryTree class requires only one instance variable: 
 
public Account root 
 
There are a number of methods that you must complete to receive marks for this section. They can be 
completed in any order. Your tasks for each method are outlined in the following sections. Remember that you 
can add any other methods you require, but do not modify existing method signatures. 
 
4.1.1 boolean beFriend(Account friend) 
The beFriend method takes as an argument a new Account to add to your database. Adhering to the rules of 
BSTs, you should traverse the tree and find the correct position to add your new friend. You must also correct 
set the left, right and parent variables as applicable. 
Note that the tests require that you add the provided Account object, not a copy. If the Account key is already 
present in the tree, this method should return false. If the Account argument is null, this method should throw 
an IllegalArgumentException. As an example, adding an Account with key 6 into the Figure above results in the 
tree shown in Figure 2 below. 
 
Figure 2 – BST with an account added with key value of 6 
  
4.1.2 boolean removeFriend(Account friend) 
The removeFriend method takes as an argument an Account to remove from your database. This method 
should search the tree for the target friend and remove them. This should be achieved by removing all 
references to the Account and updating the left, right and parent values as applicable. removeFriend should 
return true if the friend is successfully removed, false if not found or some other error case. If the friend object 
is null, an IllegalArgumentException should be thrown. As an example, removing the Account with key 4 from 
Figure 1 above. Results are shown in Figure 3 below. 
 
Figure 3 – initial BST with node removed containing key value of 4 
 
4.1.3 int countBetterPlayers(Account reference) 
The countBetterPlayers method takes as an argument an Account from which you should search for players 
with higher rank. This method should search from the reference account and increment a counter of better 
players to return. You should return the number of better players, 0 if there are none. 
Note that a greater key value does not necessarily equal a higher level. If the Account argument is null, this 
method should throw an IllegalArgumentException. As an example, using User with key 7 from Figure 1 above, 
this method should return 5. 
 
4.1.4 int countWorsePlayers(Account reference) 
The countWorsePlayers method takes as an argument an Account from which you should search for players 
with lower rank. This method should search from the reference account and increment a counter of worse 
players to return. You should return the number of worse players, 0 if there are none. 
Note that a lower key value does not necessarily equal a lower level. If the User argument is null, this 
method should throw an IllegalArgumentException. As an example, using User with key 7 from Figure 1, this 
method should return 6. 
 
4.1.5 Account highestRibbonScore() 
The highestRibbonScore method should search the tree and return the player who has the highest ribbon 
score. If there are no users with ribbons, this method should return null. 
Ribbon score is calculated by adding the ribbons together with the following points: 
GREEN = 1, BLUE = 2, GOLD = 3. 
 
Hint: You may want to add a method in the Account class for determining ribbon points of an account. 
  
4.1.6 void addPokemon(String username, Pokemon pokemon) 
The addPokemon method takes two arguments, a String username and Pokemon pokemon. 
You should search your database for a matching user and add the new pokemon to their PokemonList. You 
should also check that they do not already have that pokemon in their collection. If either argument is null, this 
method should throw an IllegalArgumentException. 
 
4.1.7 void addRibbon(String username, Ribbon ribbon) 
The addRibbon method takes two arguments, a String username and Ribbon ribbon. You should search your 
database for a matching user and add the new ribbon to their ribbons. You should also check that they do not 
already have the ribbon to be added and that they do not already have all available ribbons for the pokemon. 
If either argument is null, this method should throw an IllegalArgumentException. 
 
4.1.8 void levelUp(String username) 
The levelUp method takes as an argument a String username that you should use to search for the matching 
user in the database. You should then increment that user's level by one. If this breaches any BST rules you 
should make the necessary adjustments to the tree. As an example, Figure 4 shows an invalid tree after a levelup
 and Figure 5 shows the correct alteration. If the username argument is null, this method should throw an 
IllegalArgumentException. 
 
Figure 4 – Level up the root node causes issues with the BST structure, we need to adjust the tree 
 
Figure 5 – Level up with correct rotations in place. [titan was shifted up and blitz was removed then readded
to its correct position in the BST] 
 
Test Marks 
beFriendNullArg 1 
beFriendDuplicate 1 
beFriend 6 
removeFriendNullArg 1 
removeFriendNonExistent 1 
removeFriend 7 
countBetterPlayersNullArg 1 
countBetterPlayersNonExistent 1 
countBetterPlayers 4 
countWorsePlayersNullArg 1 
countWorsePlayersNonExistent 1 
countWorsePlayers 4 
highestRibbonScore 4 
addPokemonNullArg 1 
addPokemon 4 
addRibbonNullArg 1 
addRibbon 4 
levelUpNullargs 1 
levelUp 7 
toStringTest 3 
Total: 54  
5 Part D 
In this final section you will implement the AVL tree balancing algorithm. This will give your tree more 
efficiency as it will maintain a perfect balance as different values are added. 
 
 
5.1 boolean addAVL(Account friend) 
The addAVL methods takes as an argument an Account friend that you should add to the tree. AVL rules 
should apply, which means that if the tree becomes un-balanced, rotations should be performed to rectify. 
The problem is broken into stages in the testing file. Tests are only provided for ascending values, meaning 
they only test left rotations. Alternate tests will also test right rotations so be sure to test adding descending 
values. If the friend argument is null, this method should throw an IllegalArgumentException. 
 
This link may be useful for visualising the AVL rotations required. 
 

請加QQ:99515681  郵箱:99515681@qq.com   WX:codinghelp



 

掃一掃在手機(jī)打開當(dāng)前頁
  • 上一篇:COMP2010J代做、代寫c/c++,Python程序
  • 下一篇:&#160;XJCO1711代寫、代做C++設(shè)計編程
  • 無相關(guān)信息
    合肥生活資訊

    合肥圖文信息
    流體仿真外包多少錢_專業(yè)CFD分析代做_友商科技CAE仿真
    流體仿真外包多少錢_專業(yè)CFD分析代做_友商科
    CAE仿真分析代做公司 CFD流體仿真服務(wù) 管路流場仿真外包
    CAE仿真分析代做公司 CFD流體仿真服務(wù) 管路
    流體CFD仿真分析_代做咨詢服務(wù)_Fluent 仿真技術(shù)服務(wù)
    流體CFD仿真分析_代做咨詢服務(wù)_Fluent 仿真
    結(jié)構(gòu)仿真分析服務(wù)_CAE代做咨詢外包_剛強(qiáng)度疲勞振動
    結(jié)構(gòu)仿真分析服務(wù)_CAE代做咨詢外包_剛強(qiáng)度疲
    流體cfd仿真分析服務(wù) 7類仿真分析代做服務(wù)40個行業(yè)
    流體cfd仿真分析服務(wù) 7類仿真分析代做服務(wù)4
    超全面的拼多多電商運(yùn)營技巧,多多開團(tuán)助手,多多出評軟件徽y1698861
    超全面的拼多多電商運(yùn)營技巧,多多開團(tuán)助手
    CAE有限元仿真分析團(tuán)隊,2026仿真代做咨詢服務(wù)平臺
    CAE有限元仿真分析團(tuán)隊,2026仿真代做咨詢服
    釘釘簽到打卡位置修改神器,2026怎么修改定位在范圍內(nèi)
    釘釘簽到打卡位置修改神器,2026怎么修改定
  • 短信驗(yàn)證碼 寵物飼養(yǎng) 十大衛(wèi)浴品牌排行 suno 豆包網(wǎng)頁版入口 目錄網(wǎng) 排行網(wǎng)

    關(guān)于我們 | 打賞支持 | 廣告服務(wù) | 聯(lián)系我們 | 網(wǎng)站地圖 | 免責(zé)聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 hfw.cc Inc. All Rights Reserved. 合肥網(wǎng) 版權(quán)所有
    ICP備06013414號-3 公安備 42010502001045

    国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女av在线免费观看
    欧美亚洲国产免费| 国产经典一区二区三区| 久久大香伊蕉在人线观看热2| 午夜精品一区二区三区在线视频| 久久久在线免费观看| 日本一区视频在线| 精品国内亚洲在观看18黄 | 国产精品视频一二三四区| 欧美日韩成人一区二区三区 | 日韩精品第一页| 久久人91精品久久久久久不卡| 一区二区视频在线观看| 国产精品视频午夜| 日本丰满少妇黄大片在线观看| 久久久久www| 国产精选一区二区| 视频一区二区综合| www.亚洲一区| 国产乱淫av片杨贵妃| 无码无遮挡又大又爽又黄的视频| 久久久久久久久久久免费视频| 国产亚洲二区| 亚洲免费av网| 日韩视频欧美视频| 国产伦精品一区二区三区视频黑人| 亚洲精品乱码久久久久久蜜桃91| 日韩中文字幕在线看| 国产免费亚洲高清| 日韩av高清| 国产精品二区三区| 91精品国产成人www| 欧美亚洲免费高清在线观看| 欧美激情一二区| 国产成人精品免费久久久久 | 久久综合色影院| 色狠狠久久av五月综合|| 国产传媒欧美日韩| 欧洲精品码一区二区三区免费看| 人妻久久久一区二区三区| 久久精品xxx| 高清无码视频直接看| 欧美有码在线观看| 亚洲黄色成人久久久| 国产精品欧美在线| 国产盗摄视频在线观看| 国产精自产拍久久久久久| 欧美性猛交久久久乱大交小说| 亚洲在线观看一区| 国产精品秘入口18禁麻豆免会员| 国产精品91久久久| 国产精品亚洲一区二区三区| 欧美日本韩国一区二区三区| 日韩在线第一区| 一区二区三区欧美成人| 国产精品视频网站在线观看| 91精品国产电影| 国产伦理久久久| 精品午夜一区二区| 欧美午夜精品久久久久免费视| 动漫3d精品一区二区三区| 国产99视频精品免费视频36| 国产精品久久久影院| 久久久久久亚洲精品中文字幕| 超碰网在线观看| 国产欧美日韩在线播放| 精品1区2区| 日韩欧美在线播放视频| 偷拍盗摄高潮叫床对白清晰| 在线视频精品一区| 精品久久久久久一区二区里番| 国产成人精品自拍| 日韩在线视频线视频免费网站| 国产v亚洲v天堂无码久久久| 91精品国产99| 97精品在线视频| 99在线看视频| 97人人模人人爽人人喊中文字| 国产精品永久在线| 国产美女精彩久久| 国产伦精品一区二区| 国产欧美123| 国产精品一区二区三区免费 | 日本91av在线播放| 欧美一级视频在线观看| 亚洲va码欧洲m码| 亚洲 欧洲 日韩| 午夜久久资源| 日韩在线观看a| 日日摸日日碰夜夜爽无码| 日韩在线xxx| 日韩激情久久| 欧美视频免费播放| 女同一区二区| 精品网站在线看| 国产日产亚洲精品| 国产女教师bbwbbwbbw| 国产精品一区免费观看| 成人免费在线小视频| 99在线视频播放| 国产大片精品免费永久看nba| 国产不卡视频在线| www.xxxx欧美| 久久综合88中文色鬼| 亚洲午夜精品久久久久久人妖 | 国产成一区二区| 日韩中文在线不卡| 国产精品高清在线| 一区国产精品| 熟女视频一区二区三区| 日本一区免费看| 欧美精品一区在线| 国产青草视频在线观看| 爱福利视频一区二区| 久久精品一二三区| 国产精品视频地址| 中文字幕不卡每日更新1区2区 | 久久国产精品-国产精品| 久久综合伊人77777尤物| 久久在线免费观看视频| 一级一片免费播放| 日本免费一级视频| 蜜桃视频日韩| 成人精品视频99在线观看免费| 91美女福利视频高清| 九九热只有这里有精品| 国产精品乱码视频| 亚洲熟妇av日韩熟妇在线| 日本精品一区二区三区四区| 黄色影院一级片| av日韩一区二区三区| 国产成人三级视频| 亚洲色欲综合一区二区三区| 欧美亚洲国产免费| 成人免费毛片播放| 日韩在线播放一区| 一本久道久久综合| 欧美,日韩,国产在线| 97免费高清电视剧观看| 日韩综合视频在线观看| 欧美日韩国产123| 欧美中文字幕在线观看视频| 国产免费内射又粗又爽密桃视频 | 国产精品综合久久久久久| 久久久久久久久中文字幕| 欧美人与物videos| 青青草成人在线| 97人人澡人人爽| 国产精品久久久久久久app| 亚洲国产欧美不卡在线观看| 虎白女粉嫩尤物福利视频| 91久久久久久久久久久久久| 国产精品久久久久久亚洲影视| 午夜视频在线瓜伦| 国产中文字幕在线免费观看| 久久av免费观看| 亚洲综合色av| 蜜桃av噜噜一区二区三| 九色91国产| 亚洲欧美一区二区原创| 精品少妇人妻av一区二区| 国产黄色片免费在线观看| 九九热精品在线| 欧美牲交a欧美牲交| 99精品国产一区二区| 国产精品久久久久久久app| 色大师av一区二区三区| 粉嫩精品一区二区三区在线观看 | 国产精品都在这里| 欧美在线观看视频| 久久琪琪电影院| 亚洲中文字幕无码一区二区三区| 激情五月综合色婷婷一区二区| 久久免费一级片| 亚洲综合在线小说| 国产日韩精品电影| 国产精品视频区1| 热99精品里视频精品| 国产精品一区二区三区精品| 国产精品久久久av久久久| 热久久免费国产视频| 91精品91久久久中77777老牛| 欧美人交a欧美精品| 黄色高清视频网站| 国产成人精品综合久久久| 日本一区高清在线视频| 国产精品96久久久久久| 亚洲精品高清国产一线久久| 国产免费一区二区视频| 久久夜色精品国产欧美乱| 精品人妻人人做人人爽| 日韩视频免费在线| 欧美在线免费观看| 国产ts一区二区| 日日鲁鲁鲁夜夜爽爽狠狠视频97| 国产精品10p综合二区| 亚洲一区三区电影在线观看| 国产精品亚洲a| 久久艹在线视频| 国产人妖伪娘一区91| 久久99精品国产99久久6尤物|