java代写 java代码代写 java程序代写 java作业代写

java数据结构代写,java算法代写,java作业代写

When submitting, zip up your entire Netbeans project into a folder with the following structure; lastname_firstname_studentID.zip (using your own name and ID) and submit to the Assignment 1 folder on Blackboard BEFORE the due date and time. Late submissions will incur a penalty. Anti-plagiarism software will be used on all assignment submissions, so make sure you submit YOUR OWN work and DO NOT SHARE your answer with others. Any breaches will be reported and will result in an automatic fail and possible removal from the course.


Question 1) Zombie Simulator (recommended readings 1.3, 1.4) - 30 marks

Using the UML below, create a class called Human which represents a human being whom can walk around a simulated world.


Each Human can run as a separate thread and maintains an x,y position with periodic movements using dx, dy which change slightly after a number of iterations. A Human can be instantiated using an initial position and a list of all other humans in the world. A Human can be drawn using the draw method and passing a Graphics object around its x,y position and size. There are also a static public fields which can be set to determine the size of the world in which humans roam.


Create a Zombie class which extends a Human. Try to work out what Human fields/methods should be overridden. A Zombie has a sight distance of the entire panel and will actively seek and search out the nearest human, it will then alter its dx,dy movements towards the closest human for a fixed period of time before checking if there is any other targets it could possibly chase. A Zombie can only move half of the max speed as a human. If a Zombie manages to catch a human it will bite and kill the human.


Modify the human class so that it tries to move away from the closest zombie within its sight distance by modifying its dx,dy speed. A Human sight distance is only 1⁄4 of the world size.

Create a GUI called ZombieSimulator with two buttons, starting either a zombie or a human as a thread. The GUI should periodically redraw all Human and Zombie objects moving within the world. It should maintain a single thread safe data structure for all Zombie and Human objects. It should also periodically check if a human has been killed by a zombie, in which case it re-instantiates the object as a new Zombie thread. See below for an example screenshot, where zombies are red squares and humans’ blue circles.


Question 2) Skip List Set (recommended readings 2.2) – 30 marks

A skip list data structure is a modification of a singly linked list so that the add, contains, and remove methods are O(log2 n). Essentially it consists of a series of singly-linked lists L0, L1, ..., Lk, usually visualized one on top of another with L0 at the bottom. The list L0 holds all the (non- null) elements of the collection in order with null at the start and end of the list. Each list Li+1 holds a subset of the previous list Li and has links from each element down to the same element in the previous list. These links enable elements in the collection to be found more efficiently than by just traversing the list L0. The illustrated skip list holds three elements e0, e1, e2 in comparable order:

java代写

java数据结构代写,代写java数据结构

京ICP备2025144562号-1
微信
程序代写,编程代写
使用微信扫一扫关注
在线客服
欢迎在线资讯
联系时间: 全天