Question: C++ ASSIGNMENT SPECIFICATIONS: Create and populate a database of Student Information (including the students ID, name, and GPA). Display the information in three ways demonstrating
C++ ASSIGNMENT SPECIFICATIONS:
Create and populate a database of Student Information (including the students ID, name, and GPA). Display the information in three ways demonstrating the tradeoffs associated with the CIA model.
Download the provided data file (data.txt SEE BELLOW).
Create your source file and name it Lab9.cpp 2. Create the arrays to hold the data:
a. To store the student names, declare an array of strings to store each student (a total of 10). b. To store the student IDs, you will need another array of strings of length 10.
c. Declare an array of doubles long enough to contain the GPA for each student.
Next, you need to read the values from the text file and place into the arrays:
a. Open the file.
b. Ensure the file was opened correctly.
c. Construct a loop to read the data from the file and store it in the arrays youre created.
d. Don't forget to close the file!
Display the data in the following ways:
a.Display all of the information stored (Name, Number, and GPA). This demonstrates availability and integrity, at the expense of confidentiality.
| unaltered records: T00010000 Adam Black 3.23 T00010001 Bethany Blue 3.9 T00010002 Carl Corduroy 2.6 T00010003 Destiny Demps 3.12 T00010004 Edgar Ell Ensworth 1. 86 T00010005 Felicia Farmhouse 3.43 T00010006 Gary Gallent 2.89 T00010007 Henrietta Hooper 3.1 T00010008 Isaac Irritable 3.73 T00010009 Jessica Jumpinghorn 2.91 |
b.Display the name and number of the student, leaving off GPA. This demonstrates confidentiality and integrity at the expense of availability.
| Maintain confidentiality at expense of availability (no GPA): T00010000 Adam Black T00010001 Bethany Blue T00010002 Carl Corduroy T00010003 Destiny Demps T00010004 Edgar Ell Ensworth T00010005 Felicia Farmhouse T00010006 Gary Gallent T00010007 Henrietta Hooper T00010008 Isaac Irritable T00010009 Jessica Jumpinghorn
|
c. Modify values in the dataset while displaying it. To do this, you will use a technique called fuzzing. This modifies the value stored in an unpredictable way, ensuring that the students confidentiality with regards to his or her GPA is respected.
| Maintain confidentiality and availability at expense of integrity (noisy GPA): T00010000 Adam Black 3.85 T00010001Bethany Blue 3.4 T00010002 carl cordoroy 1. 71 T00010003 Destiny Demps 2.51 T00010004 Edgar Ellensworth 1. 37 T00010005 Felicia Farmhouse 2.53 T00010006 Gary Gallent 2.38 T00010007 Henrietta Hooper 2.91 T00010008 Isaac Irritable 2.88 T00010009 Jessica Jumpinghorn 3.07 |
You will make use of C++s random number generator to fuzz the data. i. Add the cstdlib and ctime libraries. ii. Next, seed the random number generator with the number of seconds that have passed from an arbitrary point in the past (in this case, the Unix epoch, or 00:00:00 UTC on January 1, 1970), ensuring that each time the program has run the seeds are different. The command to do this is srand(time(0)), which should be added toward the beginning of the program.
iii. Generate noise specifically formatted for modifying GPA values. To start, generate a random integer (int randomInt = rand();). Next, generate the noise value using the following command (double noise = (randomInt%100)/100.0;) According to the Quotient Remainder Theorem, the possible values of the remainder of a division operator where the divisor is n can only range from zero to n-1. The noise variable now contains a random decimal value ranging from 0.0 to 0.99. You are now ready to fuzz the GPA values. iv. Determine if you want to increase or decrease a particular GPA. To do this, check to see if the randomInt generated is even (randInt%2 ==0) or odd. If it is even (and the GPA you are adding the noise to is not subsequently greater than 4.0), then display the GPA with the added randomly generated noise. If either of those conditions is false, display the GPA with the random noise subtracted from the value. Be careful you need a new random fuzz value for each students GPA when you are displaying it. This simple precaution preserves student confidentiality (true GPA is not revealed) and availability (data is displayed for user) but at the expense of integrity (as the displayed GPA is not the true GPA).
data.txt:
T00010000
Adam Black
3.23
T00010001
Bethany Blue
3.9
T00010002
Carl Cordoroy
2.6
T00010003
Destiny Demps
3.12
T00010004
Edgar Ellensworth
1.86
T00010005
Felicia Farmhouse
3.43
T00010006
Gary Gallent
2.89
T00010007
Henrietta Hooper
3.10
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
