首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
c/c++编程代做、代写program程序
项目预算:
开发周期:
发布时间:
要求地区:
Department of Electrical Engineering and Electronics
Assignment Overview
Instantiation and manipulation of geometrical objects is significant in robotics. It is also
advantageous to be familiar with object-oriented programming features in C++. In this
assignment, you will design C++ classes capable of initialising polygons in a particular way,
and performing translations and rotations on them. This tests your ability to declare and define
classes and instantiate objects, using constructors, inheritance and polymorphism.
ELEC230 Robotic Systems
Assignment 1 – Object-Oriented Programming: Classes & Objects in C++
Module / Coursework ELEC230 / Assignment 1 – Classes & Objects in C++
Component weight 15%
Semester / HE Level 1 / 5
Lab location EEE PC Labs A402 & A406
Work Individual
Timetabled time C++ practice & advice are available in Weeks 4 – 7, totalling up to
15 hours although some time will be given to other topics. Lab
time includes time practising the C++ and OOP (Object-Oriented
Programming) exercises provided. You may ask questions about
the Assignment & relevant skills, and work on the Assignment
individually. You must write your own code & report, and
collusion, copying or plagiarism will be penalised.
Suggested private study ~10 hours – in addition to the timetabled time learning and
practising C++ and OOP.
Assessment method Individual, formal word-processed reports and .cpp files, as
described in the Marking Criteria.
Submission format Online via CANVAS using the template.
Please adhere to the template word and page limits.
Submission deadline 23:59 on Friday 10
th November 2023
Late submission Standard University penalties apply
Resit opportunity N/A
Marking policy Marked and moderated independently
Anonymous marking Yes
Feedback Via comments on CANVAS submission on-line
Learning outcomes (BH2) Understanding the features of an Object-Oriented
Programming language, and the ability to code in C++.
2
How much time did it
take YOU?
Let us know anonymously via https://bit.ly/EEECARES
Aspect
Marks
available
Indicative characteristics
Adequate / pass (40%) Very good / Excellent
Presentation
and
structure
10%
• Submission includes a Report, plus a
standalone .cpp file for each Part
attempted (one .cpp file each for Part A
and Part B). The latter are zipped while
the former is not.
• Report contains cover page
information (with Academic Integrity
declaration & Abstract), table of
contents, sections with appropriate
headings.
• Comprehensible language;
punctuation, grammar and
spelling are accurate.
• Equations, figures & tables are legible,
numbered and presented correctly.
• Excellent use of technical,
mathematic and academic
terminology and conventions.
• Word processed with consistent
formatting.
• Pages numbered, figures and
tables are captioned well.
• All sections clearly signposted.
• Excellent cross-referencing (of
figures, tables, equations) and
citations.
Introduction,
Method and
Design
40%
• Problem background is introduced
clearly
• Original code and comments
• Code is clearly laid out, easy to follow
and well- commented
• Design of each code segment follows a
logical sequence
• Design is adequately explained
• Excellent understanding of the
problem background is
displayed
• Code for each task is clean,
Don’t Repeat Yourself (in
programming), efficient and
elegant
• [Code is user-friendly if / when
relevant]
• Design is very well explained
Results 30% • Focused screenshots of program
output are presented for each task
• These include the printed output at
the terminal, and output in Desmos
and GeoGebra.
• Full-screen versions of each focused
screenshot are dumped in the
Appendix (in order of appearance in
the report). These must include the
full desktop including the taskbar
with date and time, and for the
terminal screenshots, they must also
include the IDE windows (e.g. editor
window showing program code).
• Screenshots correspond with code and
demonstrate at least partially correct
operation
• Screenshots, along with valid
code, clearly demonstrate
successful, correct output for
every task, in perfect
agreement with the
instructions and in the most
efficient way allowed by
them
• Printing to the terminal is
neat and comprehensible
(e.g. appropriate spaces, line
breaks, spelling, etc.) and
follows the exact form
instructed
• Screenshots are presented in a
coherent way that
corresponds well with the
logical flow of the report
3
Discussion 20% • Written discussion within each task
explaining each code segment. This
discussion is clearly original and shows
understanding of the relevant syntax
and semantics.
• This written discussion is in addition to
the code comments. It is accompanied
by snapshots of snippets of the code, to
illustrate the explanations.
• Discussion shows excellent
understanding.
• Coding decisions are justified.
e.g., rejected alternatives
explained.
• Some discussion of what might
be done to further enhance /
improve the program
ELEC 230 C++ & OOP Assignment 1 (2023-2024)
ProgramA (70%):
1. Write a class called polygon which can initialise regular1 Two-Dimensional (2D) polygons, and
translate them in the +/-x and +/-y directions (or both x and y). It should also be able to rotate
them by any number of degrees about any point. Come up with your own names for all class
members except N and r. The following members must be included in your class, exactly as
instructed, and must serve a meaningful purpose in your program:
• Private members:
o Member of type std::string, to store a ‘user’-defined polygon name (e.g. “t_1”)
• Note: the ‘user’-defined polygon name must always take the form l_i where
l is a letter, i an integer; this also applies in ProgramB.
o Member (r) of type double, to store the radius.
o Member (N) of type integer, to store the number of vertices.
o Member of type std::vector, to store the x-coordinates of the polygon vertices.
o Member of type std::vector, to store the y-coordinates of the polygon vertices.
o Member function which prints any object’s name, number of vertices and coordinates
(as a coordinate pair for each vertex) on screen using the standard output stream. The
printed output must take the following exact form (although obviously the ‘user’
defined polygon name, the coordinates and the number of coordinate pairs will vary).
All numerical printed output should be rounded to 5 decimal places:
t_1=polygon((1.73205,-1),(0,2),(-1.73205,-1))
• Public members:
o Constructor function which, firstly, accepts and stores the name, r and N. Secondly, it
then uses this data to initialise and store the coordinates of the polygon vertices. When
initialised, each polygon must be centred on the origin (0,0), and its base must be
horizontal (parallel with the x axis). o Member function to translate any object, and
efficiently print the object name and coordinates before and after translation, and the
translation vector applied, in the following exact form:
Before translation: t_1=polygon((1.73205,-
1),(0,2),(-1.73205,-1)) After translation by
[-4,0]:
t_1=polygon((-2.26795,-1),(-4,2),(-5.73205,-1))
o Member function to rotate an object of this class about any point, and efficiently print
the object name and coordinates before and after rotation; also, how many degrees of
rotation were applied and from what point the rotation was around. (Positive rotation
is anticlockwise.) In the following exact form:
Before rotation:
t_1=polygon((1.73205,-1),(0,2),(-1.73205,-1))
After rotation 90 degrees anticlockwise about (1,2):
t_1=polygon((4,2.73205),(1,1),(4,-0.73205))
1
‘Regular’ means that all the polygon’s internal angles are the same, and all edges are of identical length.
4
o The word ‘efficiently’ underlined twice above implies that there are opportunities here
to avoid repeating code (DRY). Can you work out how?
2. Write a program incorporating the above class in the global scope. In your ‘main’ function,
instantiate a triangle, a square and an 𝑛-gon (you choose 𝑛 > 4) using your constructor function
created above. For each polygon, following instantiation, call sequentially first the translation,
then the rotation function. Rotation must be by 90o about (a,b) and translation by (a,-b), where
a and b are the final two non-zero digits in your student ID. For each stage, (instantiation,
rotation and translation) copy and paste the relevant terminal output into
https://www.desmos.com/calculator to generate an image of a polygon, and include screenshots
of both the terminal output and the Desmos polygon in your report, as evidence of your working
program (see also Marking Criteria).
5
ProgramB (30%):
Write a second program2 by following the steps below:
1) Copy and alter your class “polygon” to create a new class3
, “polygon3d”, that can initialise,
store and print any shape – regular or irregular – in Three-Dimensional (3D) space. Get rid of the
member variable for radius, which is no longer meaningful, and alter the constructor function so that it
now directly accepts and store the coordinates of the vertices. Delete N too. Don’t make other changes
yet.
2) Rotation and translation need not be defined in polygon3d. Therefore, turn the functions for
translation and rotation into pure virtual members, making polygon3d into an abstract base class.
Convert the private members of polygon3d into ‘protected’ members to allow a layer of inheritance.
3) Create three new classes publicly inherited from polygon3d, called polygon_xy, polygon_xz
and polygon_yz. Each class must only be able to perform rotations and translations in its own active
set of planes (defined by xy, xz or yz). You should achieve this by overriding polygon3d’s translation /
rotation functions in each inherited class.
• E.g. objects of the polygon_xy class can be translated by (1,2,0) but not by (1,2,5), since this would involve
an alteration of the z-coordinates i.e. ‘movement’ in a plane other than an xy plane.
• E.g. objects of the polygon_xy class can only be rotated in an xy plane – again, z-coordinates can’t be
altered by rotations, since this would entail ‘movement’ in a plane other than an xy plane.
• Similar rules apply for polygon_xz and polygon_yz in accordance with the planes given in their names.
See the ‘Assignment 1 Support’ folder (which will be updated periodically) for help with constructor
inheritance.
Important: the format of your efficient printed output to terminal should now be changed slightly so
that the line containing name and coordinates looks like the following exact form (for example):
t_1=Polygon({(0,0,0),(2,1,3),(1,3,4)})
In a similar way to ProgramA, create a program, instantiate one object of each class, and apply a
translation and a rotation sequentially to each object. This time, choose your own (non-zero) rotation
and translation coordinates. Test and produce evidence for your report in
https://www.geogebra.org/calculator using the ‘3D Calculator’ option (in a similar way as before with
Desmos), and with terminal output screenshots.
Now choose either Task 4 or Task 5 (Not both):
4) For one of the above inherited classes, add a public member function which overloads the +
operator to add one triangle’s coordinates to another’s in a single operation. You should be able to code
“object3 = object1 + object2” with the result that the coordinates of object3’s vertices in each dimension
become a sum of those of object1 and object2. E.g.:
0
o object1 vertex coordinates: (1,2,5), (2,8,5), (4,1,5)
o object2 vertex coordinates: (2,4,6), (3,5,8), (2,1,8)
o object3 vertex coordinates become: (3,6,11), (5,13,13), (6,2,13)
2 Save your original program (ProgramA) as a .cpp file. Then, simply copy the code for class “polygon” into a new
.cpp file, rename the class “polygon3d” and modify it according to the instructions.
6
Your function should also be able to efficiently achieve printing of information about the operation,
and object details before/after it, just as with the rotation/translation functions above & in ProgramA.
In your ‘main’, instantiate some triangular objects & call this function to demonstrate its operation.
Provide appropriate evidence of this with screenshots of GeoGebra and terminal output.
5) Alternatively, in your ‘main’ function, instantiate 3 objects, each of a different inherited class
from (3). Then, by using an array of base class pointers, pointing to objects of the derived classes in
question (3), write code in your ‘main’ function to batch-translate the objects of the different derived
classes, with a single for-loop. Translations should be non-zero in the appropriate plane for each object.
(Again, choose your own translation vectors). You will utilise pre-existing functions – so, just as above
and in ProgramA, details of the individual operations and starting/finishing object details should be
efficiently printed as part of the process. Provide appropriate evidence of the batch translation with
screenshots of Desmos or Geogebra and terminal output, as before.
Notes for BOTH Parts A and B:
• All objects should be stored in the code (e.g. creating a new object of class polygon should
not have to involve deleting a previous object of this class.)
• You should find that the transformations performed by your member functions actually
alter the stored object’s attributes. So, for example, if a translation is followed by a rotation
on the same object, the coordinates passed into the rotation are the new coordinates
following the translation. (This is a requirement of the Assignment.)
• Don’t try to interface with the ‘user’ – there is no need to issue messages to the user
inviting them to enter input, etc. When instantiating or manipulating objects, just hardcode
these actions into your main function, on behalf of the ‘user’. Similarly, don’t try to create
a menu-driven program!
Important Further Hints and Notes:
1. In this particular assignment, it isn’t the destination – it’s the journey. This means that in this
assignment, the learning objectives in respect of C++ and OOP are met by following the design
instructions closely, paying particular attention to object-oriented-programming and code
efficiency where possible/relevant, and not worrying too much about (perceived) usefulness of
the resulting programs. Don’t try and shortcut the assignment instructions!
2. Refer to the ‘Assignment 1 Support’ folder – and keep referring back, as it will be periodically
updated (it may not contain much when you first look there.)
3. When it comes to writing your report, use the Submission Template which will be added to the
above folder in due course.
4. I would like to emphasise something already mentioned: DO NOT try and invite a ‘user’ to
instantiate or manipulate objects at runtime – just instantiate/manipulate ‘directly’ (on behalf of
the ‘user’, if you will) within the code of your ‘main’ function. So there will not be any call and
response at the terminal – when your programs are run, they will simply generate a bunch of
output according to what instructions you have given in the main function.
5. To initialise each polygon in Part A, you will need to first set its coordinates using N and r, then
rotate it about the origin by some amount so that the base lies ‘horizontal’.
6. Rotational matrix equation for 2D rotation of a single coordinate point, where 𝑥, 𝑦 are the
starting coordinates, 𝑥′, 𝑦′ are the coordinates after rotation, and 𝐴 is the angle of rotation about
the origin:
7
x' = x * cos(θ) - y * sin(θ)
y' = x * sin(θ) + y * cos(θ)
7. For the rotation function, you may find that you want to create a copy of your object. Note,
firstly, that the ‘=’ operator will automatically invoke the default copy constructor
(Without you needing to write a copy constructor). But what to make it equal to? That’s
where the ‘this’ keyword could come in handy. ‘this’ is a keyword which refers to the
current object. Since ‘this’ is actually a pointer, dereference it (*this) and make your
dummy/copy object equal to it.
8. If in doubt, assume within reason that the same rules about functionality and output apply for
ProgramB as ProgramA unless instructed differently. If still unsure, ask!
9. Read the Marking Criteria on Page 2 of this Assignment brief and take a look at the Assignment
1 Discussion Board on Canvas – even if you don’t have any questions, the answers to questions
there might reveal misconceptions you didn’t know you had.
Note: In the Robot Operating System (ROS), 3D rotations are achieved with quaternions. Although this
Assignment does not ask you to perform full 3D rotations or use quaternions, you can read more about
them here.
What to submit
1. Commented standalone code for each program, should be formatted and added to the report.
2. A Report as a pdf:
• Your Report should strictly follow the template provided sticking to page and word limits.
o Screenshots for each task, showing (a) the program output at the terminal and (b) the
corresponding polygons generated in Desmos or GeoGebra. (These should, of course, be
presented as figures with figure numbers and captions and annotation if required. Feel
free to combine the polygons on 1 graph)
o A discussion of each program’s design and results, showing your understanding of your
own code and of C++ features used. You can enhance this with snapshots or snippets of
your code,
• Your Report should also an Appendix with full-screen screenshots as instructed in the
Marking Criteria, p.2, in the same order of appearance as in the main body of the report.
• Follow also all the other instructions in the Marking Criteria, p.2.
Warning
When marking your reports, we will be looking very closely for any signs of collusion, as this is unacceptable.
We want to assess your own ability, not that of your friend or colleague. If we find any evidence of collusion or
copying then the formal University rules will be followed which may result in your suspension. Similarly, your
code, comments and discussion must be your own and not taken from any other source (e.g. online.) If we find
evidence that part(s) of your work is/are copied or closely paraphrased from any source then the formal University
rules will be followed on plagiarism and collusion, which may result in your suspension or termination of studies.
Submission information / deadline
Submit an Electronic copy to CANVAS by: 23:59 on Friday 10
th November 2023.
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
代做ceng0013 design of a pro...
2024-11-13
代做mech4880 refrigeration a...
2024-11-13
代做mcd1350: media studies a...
2024-11-13
代写fint b338f (autumn 2024)...
2024-11-13
代做engd3000 design of tunab...
2024-11-13
代做n1611 financial economet...
2024-11-13
代做econ 2331: economic and ...
2024-11-13
代做cs770/870 assignment 8代...
2024-11-13
代写amath 481/581 autumn qua...
2024-11-13
代做ccc8013 the process of s...
2024-11-13
代写csit040 – modern comput...
2024-11-13
代写econ 2070: introduc2on t...
2024-11-13
代写cct260, project 2 person...
2024-11-13
热点标签
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
软件定制开发网!