Tải bản đầy đủ (.pdf) (1 trang)

Bài tập thực hành lập trình cơ bản với adroid bài (8)

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (414.83 KB, 1 trang )

CIS 470 Homework 6is
Fall 2011 Android Multi-Threading

Write an Android application to implement the core of an investment game that operates as
follows:
1. Assume $100 is placed in an account at a trust fund.
2. Two financial advisers known as ‘GoodNews’ and ‘BadNews’ are assigned to the
account. Both investors operate independently from one another.
3. GoodNews strategy consists in
a. think for a while on what to do (it takes a second each time), and
b. make an investment decision that always results in a gain. The gain is a random
value less or equal to $100. The gain is added to the account to increase its
value.
4. BadNews operates in a similar way; however his decisions always produce a random
loss. The loss is at most $100 and should be subtracted from the account’s balance.
5. The goal of the game is to see whose strategy ‘succeeds’ first.
6. The game is limited to a period of time not to exceed 20 seconds.
7. The game could terminate before the allocated time if either
a. the current balance reaches $200 (twice the original allocation), or
b. the account is depleted and there is no more money.

Provide an UI showing the following elements:
c. Elapsed time (20sec. max). Use a horizontal ProgressBar or a similar visible
control.
d. Account’s balance. Use a ProgressBar initially at the middle of the scale. Gains
move the progress to the right (max scale), losses reduce the progress sending
the marker to the left (0 point in the relative scale).
e. The current value of the account.
f. A written historical sequence of gains and losses.
g. A message indicating the result of the game.
h. Start-Over / Quit buttons.


Feel free to change anything that improves the specs. Happy computing. Have fun!

×