代写 DTS102TC Programming with C++ 程序设计
XJTLU Entrepreneur College (Taicang) Cover Sheet
Module code and Title DTS102TC Programming with C++
School Title School of Artificial Intelligence and Advanced Computing
Assignment Title Coursework 1 (Assignment)
Submission Deadline 5 pm China time (UTC+8 Beijing) on Fri. 28th. Nov. 2025
Final Word Count NA
If you agree to let the university use your work anonymously for
teaching and learning purposes, please type “yes” here.
I certify that I have read and understood the University’s Policy for dealing with
Plagiarism, Collusion and the Fabrication of Data (available on Learning Mall Online).
With reference to this policy I certify that:
• My work does not contain any instances of plagiarism and/or collusion.
My work does not contain any fabricated data.
By uploading my assignment onto Learning Mall Online, I formally declare that
all of the above information is true to the best of my knowledge and belief.
Scoring – For Tutor Use
Student ID
Stage of
Marking
Marker
Code
Learning Outcomes Achieved (F/P/M/D)
(please modify as appropriate)
Final Score
A B C
1st Marker – red
pen
Moderation
– green pen
IM
Initials
The original mark has been accepted by the moderator
(please circle as appropriate):
Y / N
Data entry and score calculation have been checked by
another tutor (please circle):
Y
2nd Marker if
needed – green
pen
For Academic Office Use Possible Academic Infringement (please tick as appropriate)
Date
Received
Days
late
Late
Penalty
☐ Category A
Total Academic Infringement Penalty
(A,B, C, D, E, Please modify where
necessary) _____________________
☐ Category B
☐ Category C
☐ Category D
☐ Category E
DTS102TC Programming with C++
Coursework 1 (Assignment)
Deadline: 5:00 pm China time (UTC+8 Beijing) on Friday 28th. Nov. 2025
Percentage in final score: 50%
Maximum score: 100 marks (100% individual marks)
Learning outcomes assessed:
A. Demonstrate knowledge and understanding of basic principles of C++ programming language.
B. Demonstrate knowledge and understanding of basic software development process.
Late policy: 5% of the total marks available for the assessment shall be deducted from the
assessment mark for each working day after the submission date, up to a maximum of five working
days.
Notice:
• Please read the coursework instructions and requirements carefully. Not following these
instructions and requirements may result in loss of marks.
• The assignment must be typed in an MS Word and converted to a PDF document. The
document must be submitted via Learning Mall Online to the Gradescope. Only electronic
submission is accepted and no hard copy submission. All submissions should be written in
English.
• All students must download their file and check that it is viewable after submission.
Documents may become corrupted during the uploading process (e.g. due to slow internet
connections). However, students themselves are responsible for submitting a functional and
correct file for assessments.
• Please download the Source Code Template from Learning Mall Online. Do not change the
file name of each code script.
• Academic Integrity Policy is strictly followed.
Overview
The objective of this assignment is to develop proficiency in C++ programming and software
development skills. You are required to write a C++ program to address each question.
For each question, you must write code to generate the required results and submit it via
Gradescope for evaluation of program implementation. Additionally, for each question in your
report, you will need to prepare a brief report analyzing your methods and discussing the results
in conjunction with your test cases. Code quality—including variable naming conventions and
function comments—will also be assessed.
2
3
Section A. Fundamental of C++ Programming (70marks)
In this section, there are 9 questions. Please use the code template available on the Learning Mall
and submit your code solutions via Gradescope to pass the test cases. Note that you are limited
to 5 submissions per question on Gradescope; exceeding this maximum will result in a loss
of full marks for that question.
Question 1. Algebra: solve quadratic equations (5 marks)
The two roots of a quadratic equation 2 xbxax =++ 0 can be obtained using the following
formula:
a
acbb
r
2
2 4
1
−+− = and
a
r
acbb
2 2 =
2 −−− 4
2 − 4acb is called the discriminant of the quadratic equation. If it is positive, the equation has two
real roots. If it is zero, the equation has one root. If it is negative, the equation has no real roots.
Follow the code template to write a program that has values for a, b, and c and displays the result
based on the discriminant. If the discriminant is positive, display two roots. If the discriminant is
0, display one root. Otherwise, display “The equation has no real roots.”
Note that you can use pow(x, 0.5) to compute √𝒙𝒙 . Here are some sample examples.
Sample Run
Enter a, b, c: 1.0 -3 2
The roots are: 2.0 and 1.0
Enter a, b, c: 1 -2 1
The root is: 1.0
Enter a, b, c: 1 0 1
The equation has no real roots
Question 2. Geometry: area of a regular polygon (5 marks)
A regular polygon is an n-sided polygon in which all sides are of the same length and all angles
have the same degree (i.e., the polygon is both equilateral and equiangular).
The formula for computing the area of a regular polygon is:
where s is the length of a side. Follow the code template to write a program that has the number
of sides and their length of a regular polygon and displays its area.
Sample Run
Enter the number of sides: 5
Enter the length of a side: 6.5
The area of the polygon is 72.69
Question 3. Count positive and negative numbers and compute the average of numbers (5
marks)
Follow the code template to write a program that reads an unspecified number of integers,
determines how many positive and negative values have been read, and computes the total and
average of the input values (not counting zeros). Display the average as a floating-point number.
Sample Run
Enter an integer value, the input ends if it is 0: 1 2 -1 4 0
The number of positives is 3
The number of negatives is 1
The total value is 6
The average value is 1.50
Question 4. Binary to decimal (5 marks)
Follow the code template to write a function that returns a decimal number from a binary string.
For example, binaryString 10001 is 17 (1*2^4+0*2^3+0*2^2+0*2+1=17 ).
So, the function solve_bin_to_dec("10001") returns 17.
Question 5. Print distinct numbers (5 marks)
Follow the code template to write a program that reads in 10 numbers and displays distinct numbers
(i.e., if a number appears multiple times, it is displayed only once). The numbers are displayed in
the order of their input and separated by exactly one space.
4
(Hint: Read a number and store it to an array if it is new. If the number is already in the array,
discard it. After the input, the array contains the distinct numbers.)
Sample Run
Enter ten numbers: 1 2 3 2 1 6 3 4 5 2
The number of distinct numbers is 6
The distinct numbers are: 1 2 3 6 4 5
Question 6. Sum elements in each column (10 marks)
Write a function that returns the sum of all the elements in a specified column in a matrix using
the following header:
double sumColumn(const double m[][4], int rowSize, int columnIndex)
Follow the code template to write a program that reads a matrix and displays the sum of each
column.
Sample Run
Enter a 3-by-4 matrix row by row:
1.5 2 3 4
5.5 6 7 8
9.5 1 3 1
Sum of the elements at column 0 is 16.5
Sum of the elements at column 1 is 9
Sum of the elements at column 2 is 13
Sum of the elements at column 3 is 13
Question 7. The Rectangle class (10 marks)
Design a class named Rectangle to represent a rectangle. The class contains:
• Two double data fields named width and height that specify the width and height of the
rectangle.
• A no-arg constructor that creates a rectangle with width 1 and height 1.
• A constructor that creates a rectangle with the specified width and height.
• The accessor and mutator functions for all the data fields.
• A function named getArea() that returns the area of this rectangle.
• A function named getPerimeter() that returns the perimeter.
Implement the class. Write a test program that creates two Rectangle objects. Assign width 4 and
5
height 40 to the first object and width 3.5 and height 35.9 to the second. In the report, display the
width, height, area, and perimeters of the first object and then the second object.
Question 8. Geometry: The Rectangle2D class (15 marks)
Define the Rectangle2D class that contains:
• Two double data fields named x and y that specify the center of the rectangle with constant
get functions and set functions. (Assume that the rectangle sides are parallel to x- or y-axes.)
• The double data fields width and height with constant get functions and set functions.
• A no-arg constructor that creates a default rectangle with (0, 0) for (x, y) and 1 for both width
and height.
• A constructor that creates a rectangle with the specified x, y, width, and height.
• A constant function getArea() that returns the area of the rectangle.
• A constant function getPerimeter() that returns the perimeter of the rectangle.
• A constant function contains(double x, double y) that returns true if the specified point (x, y)
is inside this rectangle. See Figure (a).
• A constant function contains(const Rectangle2D &r) that returns true if the specified rectangle
is inside this rectangle. See Figure (b).
• A constant function overlaps(const Rectangle2D &r) that returns true if the specified rectangle
overlaps with this rectangle. See Figure (c).
In the report, draw the UML diagram for the class. Implement the class with the testing cases.
Question 9. Geometry: find the bounding rectangle (10 marks)
A bounding rectangle is the minimum rectangle that encloses a set of points in a two-dimensional
plane, as shown in Figure (d). Write a function that returns a bounding rectangle for a set of points
in a two-dimensional plane, as follows:
const int SIZE = 2;
Rectangle2D getRectangle(const double points[][SIZE]);
Write another function that returns a pointer to the bounding rectangle as follows:
6
Rectangle2D* getRectanglePointer(const double points[][SIZE]);
The Rectangle2D class is defined in Question 8.
Follow the code template to write a program that enters five points and displays the bounding
rectangle’s center, width, and height.
Sample Run
Enter five points: 1.0 2.5 3 4 5 6 7 8 9 10
The bounding rectangle’s center (5.0, 6.25), width 8.0, height 7.5
The bounding rectangle’s center (5.0, 6.25), width 8.0, height 7.5
Section B. Assignment Report (30 marks)
1) For all questions, correctly describe and analyse the key functions. Provide the program testing
and execution which performs the calculation and arrives at the correct answer for the test
cases (2 marks * 9 = 18 marks)
2) For all questions, provide clear and concise code with meaningful variable names and
comments (1 marks * 9 = 9 marks)
3) Report quality: logical structure follows the template, adherence to 5-page limit, PDF format,
no major grammar/spelling errors, etc. (3 marks)
Submission
Each individual student must submit the following files:
 Report: A Student Name_ID.pdf file contains a cover letter with your information. This is a
short report involves the program design, test results, and analysis comments for each question.
The report should not exceed 5 pages.
 Code: A Student Name_ID.zip file should include your program implementation, with all
source code files. Please do not change the file names from the source code template. You
must submit this source code on Gradescope, including all questions, even if you have not
answered some of them.
 You are allowed 5 resubmission attempts for your code on Gradescope. If you exceed this
limit, your score will be based on your last submission.
End of Coursework
7

热门主题

课程名

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
站长地图