瀏覽代碼

First ReadMe

Ian 9 年之前
父節點
當前提交
17b9e24de5
共有 1 個文件被更改,包括 41 次插入0 次删除
  1. 41
    0
      README.md

+ 41
- 0
README.md 查看文件

@@ -0,0 +1,41 @@
1
+#Input Validation in Objects
2
+
3
+## Introduction
4
+
5
+It is important to check all input. A program input can be used to delete or damage data, obtain sensitive information or propogate worms. All input must be threated as potentially dangerous.
6
+
7
+Classes can use public and private member variables. In this lab you will learn the importance of creating private variables. You will implement the validating system in the class `BPlayer`. 
8
+
9
+---
10
+
11
+The program that you will be editing is a Basketball Statistics Tracker.
12
+To understand the program you will need to learn basketball point system.
13
+* Free throw - counts 1 point
14
+* Field goal - counts 2 points
15
+* Three point - counts 3 points
16
+* Rebounds - add 1
17
+* Assist - add 1
18
+* Steals - add 1
19
+* Blocks - add 1
20
+* Fouls - add 1
21
+* Turnovers - add 1
22
+
23
+Note that these variables are declared private, and they are unsigned short.
24
+Remember that unsigned short does not have negative numbers.
25
+
26
+The program lets the user add or remove stats. You will need to implement a system in the setters that validates if the user wrongly removes stats. For example, if the player has 0 assist, and the user removes an assist, the setter will need to verify and tell the user.
27
+
28
+**Instructions**
29
+1. In `BPlayer.cpp`, add input validation in:
30
+	* `void remPoints();`
31
+	* `void remReb();`
32
+	* `void remAst();`
33
+	* `void remStl();`
34
+	* `void remBlock();`
35
+	* `void remFoul();`
36
+	* `void remTurnover();`
37
+2. Run and verify that it works.
38
+3. In `BPlayerClient.cpp`,
39
+	* In the function `void options(vector<BPlayer> &team, int &game)`, add input validation
40
+	* Validate that the user never enters negative numbers
41
+	* Validate that the user selects a team between 1 and 15.