首页 » C#辅导 » C#代写 | COIS 2020H Assignment 1

C#代写 | COIS 2020H Assignment 1

这个作业是创建一系列对象,将这些对象的集合存储在数组和链接列表中,并且需要对这些结构执行基本操作
COIS 2020H Assignment 1
While not explicitly for marks, your assignment should have readable spelling and grammar, your source code should have comments explaining what each class, and what each method is for, and your testing should cover the major points listed below. You should also have a brief explanation of how to run your program if it isn’t just a generic C# project in visual studio, and the program should be sufficiently functional that I can figure out how to use it. You should include some program output (in this case a console window) in your testing document as well, but it should cover major use cases.
1. Primary Programming Question (5 marks)
Overview:

You are going to create a series of objects, that will have a position (which is itself an object). You’re going to store collections of these objects in an array and a linked list, and you will need to perform basic operations on those structures.
Classes:

Class Position:
this will have doubles x and y, with setters and getters. You will limit these values to +/- 100.00 (If inputted a value outside that range, clamp to the closest value).
Method move which takes doubles dx and dy and changes the position by + dx and + dy (it camps to the edge).
You may also need a ToString method as well.
Class Animal:
Properties: int ID, String name, double age, double mass, position pos.
Methods. Setters and getters for the properties. Move (takes a dx and dy and moves object by that amount). Move should check for edges of valid positions and clamp the object to that location.
ToString, (public override string ToString()) each subclass will implement their own, but it should just print off all of the properties in some sane format.
Animal subclass: Cat

Enumerable property Breed {Abyssinian, Bengal, Cornish Rex, Himalayan, Ocicat, Serval}
Animal Subclass: Snake
Properties: double length, bool venomous.

Main method:
Note: I deliberately throw a lot of randomness on my assignments to simulate the fact that data can be whatever is. For your development/testing work without randomness or use a fixed random seed so it’s always the same, and then test the proper randomness once the regular case works.
Generate a series of cats and snakes with random properties (10 of each), use names from the files provided, but randomly chosen, and load them into an array and a linked list (it can be the same objects in both or at least identical objects in both). Recall that to use a built in Linked List you will need to

using System.Collections.Generic;
Traverse each collection (the array and linked list) and print off the properties. A foreach loop is fine.

Other methods
Write an algorithm to create a sorted array with the following rules: It should order items by a series of 10×10 boxes row by row top to bottom, so an object in the top left corner (-100, 100) will be the first element in the array, then the row from x= -100-> 100 and y from 90-100 will be the first set.
If you need a visualisation of what I mean, would be the order each cell would be sorted if we were sorting the cells, on a 40×40 grid with the origin in the middle

Within a ‘cell’ objects still need to be sorted by the same rule(x position first, y position second), and those numbers aren’t the array indices, the array should just be in that order.
This sorted array does not need to be done in place.
Print off the elements in the sorted array, in order. (You don’t need to actually have a grid, just print them off in the correct order), I would just show the ID and the position for readability.
Analyse (i.e. write) a description of the efficiency of your algorithm/Big Oh (put this in the theory section below)

Write a method to create a new LinkedList (sortedlist) which creates a new linked list, sorted alphabetically by the name of the animal.

Write a method which randomly moves the objects in the array some small amount (dx, dy) where dx and dy are <= 10.0, re-sort the array, print off the result. (This move will need to call the position move method)

Theory:
I would expect your answers to these questions to be < 100 words except maybe the analysis of your algorithm efficiency. 1. Put your discussion of the efficiency of your array sorting algorithm here 2. How would the efficiency of your algorithm change in 3 dimensions with the same basic rules (sort in x before y before z)? 3. Given an array of n elements (where n is some reasonable number), what is the complexity of rotating all elements in an array one element to the left (e.g. {1, 3, 5, 7} -> {3, 5, 7, 1}? How is that different for a Linked List? (obviously you can look this question up, but don’t copy paste).
4. Describe and algorithm to take your sorted (by name) linked list of animals into a list which is sorted cats first (still alphabetically), then snakes. I’m not asking you to implement this because the fast way to do this involves two pointers to nodes – which we’ll talk about when you build your own linked lists (next assignment).


程序辅导定制C/C++/JAVA/安卓/PYTHON/留学生/PHP/APP开发/MATLAB


本网站支持 Alipay WeChatPay PayPal等支付方式

E-mail: vipdue@outlook.com  微信号:vipnxx


如果您使用手机请先保存二维码,微信识别。如果用电脑,直接掏出手机果断扫描。

blank
标签:

发表评论

您的电子邮箱地址不会被公开。