Home Page > > Details

EEE102 Course AssignmentHelp With , C++ Assignment,Help With Programming Assignment, c/c++ Programming Assignment Python Programming|Help With R Programming

EEE102 Fundamental of C++ Assessment 1
1
EEE102 C++ Programming and Software Engineering II
Assessment 1
Assessment Number 1
Contribution to Overall Marks 65%
Submission Deadline Sunday, 14 June 2020, 23:59
How the work should be submitted?
SOFT COPY ONLY !
(MUST be submitted through ICE so that we can run your programs during marking.)
Make sure your name and ID are printed on the cover page of your report.
Assessment Overview
This assessment aims at testing some basic concepts of C++ programming and initiates the routine of
code development using the software development process (SDP), namely the five main steps of the
software development process:
1. Problem statement: formulate the problem.
2. Analysis: determine the inputs, outputs, variables, etc
3. Design: define the list of steps (the algorithm) needed to solve the problem.
4. Implementation: the C++ code has to be submitted as a separate file. Just indicate here
the name of the file.
5. Testing: explain how you have tested and verified your C++ program.
You will need to apply this methodology to each one of the following simple exercises.
What should be submitted?
A short report (up to a few pages of texts plus C++ source codes) detailing for all the questions of
the assignment. The answer for each question should follow the SDP method:
a) Overall quality of report (10%)
b) SDP steps 1 to 3. (30%)
c) SDP step 4 (implementation): your C++ source code including the comments. (40%)
d) SDP step 5 (testing): you will explain how you have tested the correctness of your
C++ program and will include some sample runs of your C++ Programs. (20%).
Testing result must be shown by screenshot.
The report in either Microsoft Word format (.DOCX file) or PDF format together with C++ source
code for all questions should be zipped into a single file. (For maintenance purposes, it is
always a good practice to comment your code as you go. The comments state the aim of the
program, what are the inputs, what are the outputs, which algorithm is used, who is the author
and so on.)
EEE102 Fundamental of C++ Assessment 1
2
EXERCISE 1: OPERATORS AND VECTORS IN C++ (10 POINTS OUT OF 65)
You're now a baseball game point recorder.
Given a list of strings, each string can be one of the 4 following types:
 Integer (one round's score): Directly represents the number of points you get in
this round.
 "+" (one round's score): Represents that the points you get in this round are the
sum of the last two valid round's points.
 "D" (one round's score): Represents that the points you get in this round are the
doubled data of the last valid round's points.
 "C" (an operation, which isn't a round's score): Represents the last valid round's
points you get were invalid and should be removed.
Each round's operation is permanent and could have an impact on the round before
and the round after.
You need to return the sum of the points you could get in all the rounds.
Note:
The size of the input list will be between 1 and 1000.
Every integer represented in the list will be between -30000 and 30000.
Example:
Input: ["5","2","C","D","+"]
Output: 30
Explanation:
Round 1: You could get 5 points. The sum is: 5.
Round 2: You could get 2 points. The sum is: 7.
Operation 1: The round 2's data was invalid. The sum is: 5.
Round 3: You could get 10 points (the round 2's data has been removed). The sum is:
15.
Round 4: You could get 5 + 10 = 15 points. The sum is: 30.
EEE102 Fundamental of C++ Assessment 1
3
EXERCISE 2: CLASS AND OBJECTS (15 POINTS OUT OF 65)
Design a new class to represent a fraction (a ratio of two integer values).
The data members of the class Fraction are two integers top and bottom, denoting the
numerator and denominator, respectively.
Part 1: Fundamental requirements for the class Fraction.
1. Fractional numbers can be declared with both a numerator and denominator, or
simple numerator: (3 points)
Fraction a; // represents 0/1
Fraction b(3,4); // represents 3/4
Fraction c(5); // represents 5/1
2. Fractions should be able to act just like other numbers. (4 points)
Add, subtract, multiple and divide;
Compare based on values;
Input and output.
Part 2: Advanced requirements
3. Reducible fractions (numerator and denominator have a common divisor) should be
converted to irreducible fractions automatically. (4 points)
Example: 10/14 would be converted into 5/7 automatically;
4. Write methods to convert between decimals and fractions. (4 points)
EXERCISE 3: INHERITANCE (15 POINTS OUT OF 65)
Derive a sub-class iFraction from the base class Fraction, which was designed by you in
the above Exercise. The iFraction class represents the mixed fractions like
Part 1: Design the sub-class iFraction: (8 points)
1. It should have a constructor for initialisation;
2. It should contain a method to display the mixed fraction on screen;
Part 2: Design an external function convertF (not function member of class Fraction
and iFraction) to convert the mixed fractions to improper fractions. (7 points)
Hint: convertF can be the friend function of those two classes.
EEE102 Fundamental of C++ Assessment 1
4
EXERCISE 4: MATRIX MANIPULATIONS USING THIRD PARTY LIBRARY (10 POINTS
OUT OF 65)
Eigen (http://eigen.tuxfamily.org/dox/index.html) is a high-level open-source C++ library of
template headers for linear algebra, matrix and vector operations, geometrical
transformations, numerical solvers and related algorithms. It’s fast and well-suited for a
wide range of tasks, from heavy numerical computation, to simple vector arithmetic.
Please solve the following problems by using Eigen built-in functions.
1. Define two integer type 3*3 matrices, show addition, subtraction, multiplication of
them; (3 points)
2. Define a random 4*4 matrix, obtain and display its transposition, conjugation and
trace, inverse and determinant; (4 points)
3. Define a float type 5*5 matrix, show its eigendecomposition. Please use two
different solvers. (3 points)
EXERCISE 5 (15 POINTS OUT OF 65)
This is a computer game with different types of player. Take the code provided for the
container class (container.h), player class (player.h) and the swordsman class
(swordsman.h), and the main function (main.cpp).
Part 1:
1. Read the source codes, understand the meaning and fill the blank (shown
as) to make it work; (3 points)
2. Generate the CRC cards of the classes: clarify the responsibilities of each class,
illustrate the collaboration with others and label all the members’ as public,
protected and private. Then draw the hierarchy chart of them; (3 points)
Part 2:
3. Design another two classes, archer and mage. Generate their CRC card and put
them in the hierarchy chart drew above. Write the code for these two classes
and make them work (cooperate with main function); (4 points)
4. Modify main function, to have enemies with all three professions (could be
randomly chosen). (3 points)
Part 3:
5. The factors are imperfect, make the fight too hard or too easy. Change
whatever you want, but leave hints for reviewers to know what you have done.
(2 points)

Contact Us - Email:99515681@qq.com    WeChat:codinghelp
Programming Assignment Help!