首页 > > 详细

辅导C/C++编程、C/C++编程解析、讲解留学生C/C++程序、C/C++设计辅导留学生

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) 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. (50%)
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.
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 File Operation Assessment 5
2

EXERCISE 1 (35 POINTS OUT OF 35)
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 10000. 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 80 squares (20
on each side). Each square has a price tag (this price may be generated randomly within a price range
say from 10 to 500) for the ownership except for the left bottom corner square which is the starting
square (each game starts from here). Each player’s account balance will be increased by 200 for each
time the player passes this 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 on the board. You can decide whether or not you should buy the square on which you have
just landed, only if this square is unoccupied (so this means each square except the starting one has an
ownership attribute). On the other hand, you will be fined by 10% of the square price if this square is
occupied by your opponent and the adjacent squares are unoccupied or occupied by you. This fine will
be increased to 15% if one of the adjacent squares is also occupied by your opponent (which means
you opponent has purchased 2 consecutives squares) and further to 20% if both of the adjacent squares
are also occupied by your opponent (which means you opponent has purchased 3 consecutives
squares). The fine is topped at 20% of the square price even if more than 3 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.
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).
Bonus points: your program can resume a game which was played half way through last time and
saved to the database.
Note: you have to make your coding comments as you go

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!