代做Assignment 2代写C/C++程序

Assignment 2 100 marks possible

When submitting, zip up your entire Netbeans projects (Try to create and include your “.jar” files of your Noise Removing and Maze projects) into a folder with the following structured file name:

lastname_firstname_studentID.zip (using your own name and ID)

Assignment 2.zip contains (see the image on the side):

•     studentapp folder (for entire question 1 project)

•     noiseremoving folder (for entire question 2 project)

•     maze folder (for the entire question 3 project)

and submit the Assignment 2 zipped folder on Canvas BEFORE the

due date and time. Late submissions will incur a penalty. Antiplagiarism software will be used on all assignment submissions, so make sure you submit YOUR work and DO NOT SHARE your answer with others. The project's source code templates are given. Please DO NOT change the package name.

Question 1: Binary Tree and Student Sorting (50%)

The purpose of this question is to have an opportunity of understanding and manipulate a binary tree and utilize the binary tree to create a program that sorts elements by different fields and can search  an element by a searching key. The binary tree is built by a key of the node (Key can be different

types)

Student Class

Create a Student Class that stores student’s name, score, and comments.

Name and comments are String type and score is Float type.

Student Class has a “toString” method which returns the name, score, and comments of the student and each of the details should be on separate lines. Such as:

Student07

Score: 25.759476 Comments 6

//name

//score

//comments

Node Class

Create a Node Class that has element, key, and linkers parts.

The “element” of a Node class is a generic type. It references any type of object. This project, it references a Student object.

The “key” is used to compare different nodes. It must be a Comparable Object and generic type.

If the key is a String type, then the tree must be built by the name of the students.

If the key is a Float type, then the tree must be built by the score of students.

Node Class has a node linker named “left” which references to a node that has a smaller key value.

Node Class has a node linker named “Right” which references a node that has a greater key value.

Node Class has a “compareTo” method. “compareTo” method takes a Node object in and compares it to the current node by their keys.

It returns:

= 0: if current node’s element equals to the argument node’s element.

< 0: if current node’s element is less than the argument node’s element.

> 0: if current node’s element is greater than the argument node’s element.

BinaryTree Class

Create a BinaryTree Class which builds and manages a binary tree.

BinaryTree Class has a Node reference named “root” to reference to the root node of a binary tree.

BinaryTree Class has an int variable named “number_of_nodes” to store the number of nodes that a

binary tree has.

BinaryTree Class has a Node array named “nodeList” to store sorted nodes. (The assignment was

designed to output the sorted a txt file. Now, to make it simple, the binaryTree provides a node array to store sorted nodes instead of a text file)

BinaryTree Class has an “addElement” method. It takes an element and a key then it creates a Node object. The Node object loads element and key then is passed to addNode() method to attach on the tree.

BinaryTree Class has an “addNode” method. It takes a root and a new node to create a tree when the tree is empty or adds a new node to the binary tree.

BinaryTree Class has a “reverseOrder” method. It manipulates the binary tree. By default, if we call in-order traversal method, it displays nodes’ details in the order of from smallest key value to the   largest key value.  If reverseOrder method has been called, then traversal method displays nodes’ details in the order of from largest key value to the smallest key value.

The time complexity (Big O) of “reverseOrder” method must be n. Please do not rebuild your tree ( Big O of rebuild a tree is nlog2 n). Comment your solution, please.

BinaryTree Class has a “searchElement” method. It takes a key which is a generic type then creates a target node object which is a Node object and loads key to the target node. The target node is passed to the searchNode() method to do the searching job. “searchElement” method returns a

generic type element if searchNode() returns a Node object. Otherwise, it returns null. The target node only contains a key value for searching.

An example of how searchNode() method is called in the searchElement() method: Node targetNode = new Node(); targetNode.key = “Student01”;

Node resultNode = tree.searchNode(tree.root, targetNode);

BinaryTree Class has a “searchNode” method. It takes a root and target node. It returns a node if it finds the node. Otherwise, it returns null.

In this assignment, the searchingResultNode.element references a Student object which contains all the details of that student.

For a better understanding of adding and searching students, please see the diagrams after StudentManager class.

BinaryTree Class has a “toSortedList” method. It travels each node of the current tree and stores the nodes to the “nodeList” array.

BinaryTree Class has a “traversal” method. It travels each node on the current tree and display

node.elements’ details in the order of from the smallest key value to the largest key value, or from the largest key value to the smallest key value (it depends on whether reverseOrder() has been

called).

Helps on reverseOrder() method

If you do not know how this can be done, please draw two binary trees with the same data inputs.

When you draw the second tree, you put a node with a bigger key value on the left and a smaller key value on the right.

Check the difference between these two trees. I am happy to discuss it with you in the lab.

Wish it helps

You are welcome to add more methods or fields if you need them.

Fully comments on the methods of addNode(), searchNode(), reverseOrder() and traversal().

You may lose 20% of the marks if you don’t give the comments to those methods.

StudentManager Class

StudentManager class has a BinaryTree object named “bTreeScore” which stores Nodes. All nodes are arranged by the students’ scores (node.key is Float type).

StudentManager class has a BinaryTree object named “bTreeName” which stores Nodes. All nodes are arranged by the students’ names (node.key is String type).

StudentManager class has a method named “addStudent” which takes a String name, a Float score, and a String comments to create a Student object then calls addToTree() twice and passes the

Student object with different keys (name or score) to add on different trees.

StudentManager class has a method named “addToTree” which takes a Student object and a key (the type of key can be Float or String) to add to the bTreeScore or bTreeName (put a node on different

trees)

StudentManager class has a method named “findStudent” which takes a searching key and returns a student that matches the searching key by calling binaryTree. searchElement(key). If the student

does not exist, it returns null.

StudentManager class has a method named “getSortedStudentList” which takes a key (the type of key can be Float or String) and returns a Student array. The elements in the Student array must be sorted by the key.

StudentManager class has a method named “reverseOrder” which calls the BinaryTree objects to reverse the order of the trees.

You can add more methods or fields as you wish, but you must pass the testing code (StudentApp.java).

Question 2 Sorting: Noise Removing Application (20%)

Problem: Salt-and-pepper noise, also known as impulse noise, is a form of noise sometimes seen on digital images. This noise can be caused by sharp and sudden disturbances in the image signal. It

presents itself as sparsely occurring white and black pixels.

See more information:

https://en.wikipedia.org/wiki/Salt-and-

pepper_noise#:~:text=Salt%2Dand%2Dpepper%20noise%2C,occurring%20white%20and%20black%2 0pixels.)

Example (image with Salt-and-pepper noise)

An effective noise reduction method for this type of noise is a median filter.

Median Filter:

A program reads a pixel and its 8 surrounding pixels (This 3x3 block of pixels is called a sliding window in digital image processing) from an image and then finds the median of these 9 pixels. Finally, the

median replaces the central pixel. The sliding window moves onto the next pixel and repeats this process until all pixels have been changed (To make the assignment simple, it excludes the bound pixels).

Median: the middle score when all the scores are arranged in order of size from the smallest to the highest. If there is an even number of scores, then it is the average of the two middle scores (It will not be the case in this assignment).

The code of reading the image, getting pixels, and saving pixels to an image has been done for you. Your task is to find the median for given pixels. To find the median, you need to sort an array of 9  pixels. Example (output image after removing noise)

Your task:

Please download the “NoiseRemoving.zip” file and extract it to a folder. The project contains

two .java files. “ImageProcess.java” and “NoiseRemoving.java”. If you run the project, it loads an   image and generates a .jpg file, named “noise_removed.jpg”, but the generated image still contains noise for now. You need to complete the method of “cleanNoise” to clean the noise in the

ImageProcess class.

ImageProcess.java” deals with an image. It has a method named “cleanNoise”. There is a gap in the method. You need to add your ArraySort Class to the project and fill the gap to complete the

ImageProcess Class (3%).

You need to write an “ArraySort” Class. It takes a generic Comparable type of array and sorts array in order.

ArraySort Class has an “array” field. It stores a reference of an array. (1%)

ArraySort Class has a “setArray” method. It takes a reference of an array and passes the reference to the “array” field. (1%)

ArraySort Class has a “quickSort” method. It runs a quick sort algorithm and sorts arrays in order.(3%) DO NOT COPY THE CODE FROM THE CHAPTER 3 EXAMPLES

ArraySort Comparable>

+ array : E[ ]

+ setArray(E[ ] array) : void + quickSort() : void

PLEASE FULLY COMMENT YOUR CODE OF quickSort() (3%)

Answer following questions in your Comments at the beginning of your ArraySort Class code.

1.    Is quick sort the best way of finding median? Why? (3%)

2.   What is another good way of finding median? Please provide your explanation. (3%)

Finally, you need to design a GUI of noise removing application (2%). So, the application can load an image, clean the noise, and save to a new image. And produce a .jar file of this project. (1%)

*If you are interested in image process, you may try some open-source library. OpenCV for C/C++ or JavaCV for Java.

Question 3: Maze (30%)

You are going to design a program. It loads a maze from a maze text file then the program walks through the maze and finds the path from the starting node to the exiting node.

Maze text file format:

Number of linkers, Number of columns, number of rows (Header of maze)

Node’s name, x position, y position, next linked node name, next linked node name

Node’s name, x position, y position, next linked node name, next linked node name Example:

22,7,6

START,0,2,B,A B,1,2,C,K

C,1,3,D,E

V,4,1,N,A

EXIT,6,2,A,A

“A” is the same as null. It means not next linked node on this path (this path has no exit).

“W” links to exit.

Your task is to write a program. The program does:

•     Loads a maze txt files (there are two txt files in the project folder. Please do not move them to somewhere else) (3%)

•     Draws a maze on the panel (You are going to decide how to label the nodes). (3%)

•    Walk through the maze and find a path from start to exit. (5%) You need to show an animation of how your program finds a path from start to exit. (3%)

•     Highlight the trail from “Start” to “Exit” on the panel (see image below). (3%)

•     Display the path from “Start” to “Exit”. (5%)

•     make sure your program works for both txt files. (7%) GUI is provided. (1%)

A jar file is created.

A demonstration is available during the lecture. If you missed the lecture, please ask the lecturer to run a demonstration in the lab.



热门主题

课程名

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
联系我们
EMail: 99515681@qq.com
QQ: 99515681
留学生作业帮-留学生的知心伴侣!
工作时间:08:00-21:00
python代写
微信客服:codinghelp
站长地图