EEE102 Assessment 3
1
EEE102 C++ Programming and Software Engineering II
Assessment 3
Assessment Number 3
Contribution to Overall Marks 35%
Submission Deadline Wednesday, 01-May-2019, 23:59
How the work should be submitted?
SOFT COPY ONLY !
(MUST be submitted through ICE so that the TAs 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:
- Problem statement: formulate the problem.
- Analysis: determine the inputs, outputs, variables, etc
- Design: define the list of steps (the algorithm) needed to solve the problem.
- Implementation: the C++ code has to be submitted as a separate file. Just indicate here the
name of the file. - 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) SDP steps 1 to 3. (30% of the total marks for that question)
b) SDP step 4 (implementation): your C++ source code including the comments. (40%)
c) 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.
Besides, the overall quality of report will account for 10% of the total marks.
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 Assessment 3
2
EXERCISE (35 POINTS OUT OF 35)
Monopoly
You are asked to program a game called Monopoly in C++. This game is played by two players (you
and computer in this assignment). The game and its rules are described as the follows.
To play this game, every player must set up an account first with positive balance say the starting
deposit is 5000. This means that you have to set up a data base (a file) which records the players’
information, for example, name, gender and account balance etc. and the program is supposed to be
able to track the balance changes as the game is going.
This game is played on a game board as shown in Fig. 1. This game board consists of 38 squares.
Each square has a price tag (this price may be generated randomly within a price range say from 10
to 300) for the ownership except for the left top corner square which is the starting square (“GO”
square, each game starts from here). Each player’s account balance will be increased by 200 for
each time the player passes this square (the“GO”square).
You and the computer take turns to roll a dice. The outcome of each rolling (a random number
within the range of 1 to 6) decides how many squares you/computer can advance in a clockwise
direction on the board. After you have landed on a square: - if this square is unoccupied (so this means each square except“GO”and“JAIL”has an
ownership attribute): you can decide whether or not you should buy it; - if this square is occupied by you (you’ve already bought it), then nothing needs to be done;
- if this square is occupied by your opponent and the adjacent squares are unoccupied or occupied
by you: you will be fined by 10% of the square price; - if this square and one of its adjacent squares are both occupied by your opponent (which means
you opponent has purchased 2 consecutives squares): you will be fined by 20% of the square
price; - The fine is topped at 20% of the square price even if more than 2 consecutive squares have been
occupied by your opponent.
The fine for each square can be further increased by 5% if the owner decides to invest on the square
he/she has just bought off. The size of investment is half of the square price (which means the owner
needs to pay 1.5×price to buy and invest the square).
If the player lands on the“JAIL”square (the right bottom square), he/she needs to wait for a round
before continue moving;
The game ends when either one of the players declares bankruptcy (the balance <=0) or you have
chosen to quit the game.
You should design and implement at least 3 classes (objects).
EEE102 Assessment 3
WX:codehelp