/
p2.cs
158 lines (135 loc) · 5.04 KB
/
p2.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
// AUTHOR: Colin Brinton
// FILENAME: p2.cs
// DATE: 1/20/2016
// REVISION HISTORY: 1.0
using System;
namespace P2
{
class P2Driver
{
const int TEST_DEBTS = 3;
const int TEST_MAX = 3;
const int ID_MIN = 100000;
const int ID_MAX = 1000000;
const int MONEY_MIN = 0;
const int MONEY_MAX = 150000;
const int MIN_DATE = 18000100;
const int MAX_DATE = 30001231;
static Random rnd = new Random();
static void Main()
{
Console.Write("Generating an array of studentStat objects with capacity of ");
Console.Write(TEST_MAX);
Console.Write(": ");
Console.WriteLine();
studentStat[] studentCollection = new studentStat[TEST_MAX];
int count = 0;
foreach(studentStat element in studentCollection)
{
studentCollection[count] = new studentStat();
++count;
}
Console.Write("studentStat array of length ");
Console.Write(studentCollection.Length);
Console.Write(".");
Console.WriteLine();
studentStatSetup(ref studentCollection);
testTotalBurden(ref studentCollection);
testIndexMost(ref studentCollection);
Console.ReadKey();
}
static void testIndexMost(ref studentStat[] studentCollection)
{
int count = 0;
foreach (studentStat element in studentCollection)
{
Console.Write("Which degree carries the most debt for student #");
Console.Write(count);
Console.Write(": ");
Console.Write("Debt Stat #");
Console.Write(studentCollection[count].indexMostBurden() + 1);
Console.WriteLine();
++count;
}
}
static void testTotalBurden(ref studentStat[] studentCollection)
{
int count = 0;
foreach (studentStat element in studentCollection)
{
int totalBurden = new int();
totalBurden = studentCollection[count].totalBurden();
Console.Write("Total Debt Burden for Student #");
Console.Write(count + 1);
Console.Write(" is : $");
Console.Write(totalBurden);
Console.WriteLine();
++count;
}
}
static void studentStatSetup(ref studentStat[] studentCollection)
{
int count = 0;
foreach (studentStat element in studentCollection)
{
Console.WriteLine();
Console.Write("STUDENT ");
Console.Write(count + 1);
Console.WriteLine();
Console.Write("Please enter a student ID: ");
int testID = new int();
testID = randomNum(ID_MIN, ID_MAX);
Console.Write(testID);
Console.WriteLine();
Console.WriteLine();
for (int index = 0; index < TEST_DEBTS; ++index)
{
Console.Write("****Debt Stat #");
Console.Write(index + 1);
Console.Write("****");
Console.WriteLine();
Console.Write("Enter loan amount: $");
int testLoan = new int();
testLoan = randomNum(MONEY_MIN, MONEY_MAX);
Console.Write(testLoan);
Console.WriteLine();
Console.Write("Enter grant amount: $");
int testGrant = new int();
testGrant = randomNum(MONEY_MIN, MONEY_MAX);
Console.Write(testGrant);
Console.WriteLine();
Console.Write("Enter matriculation date (YYYYMMDD): ");
int testMatric = new int();
testMatric = randomNum(MIN_DATE, MAX_DATE);
Console.Write(testMatric);
Console.WriteLine();
Console.Write("Enter graduation date (YYYYMMDD): ");
int testGrad = new int();
testGrad = randomNum(MIN_DATE, MAX_DATE);
Console.Write(testGrad);
Console.WriteLine();
studentCollection[index].constructStats(testID, testLoan, testGrant, testMatric, testGrad);
}
++count;
}
Console.WriteLine();
}
public static int randomNum(int min, int max)
{
return rnd.Next(min, max);
}
void studentDriver()
{
int selection = 0;
while (selection != 7)
{
switch (selection)
{
case 1:
break;
}
}
Console.WriteLine("Please chose a number from the menu: ");
}
}
}