Well, I'm down to the last parts now. I've got about 6 things left to build but there are three things that're making me scratch my head. I'd have some coffee and keep at it, if I didn't have to get some sleep for work and all.
Anywho, less chat more details I suppose.
Things left to do:
#1 - Figure out Why it is when I input an ID code on the second student, if I use the same ID code, it doesn't check against the students List. I can't figure it out, although some of that could be the time.
#2 - add fields to the struct Info to give myself the ability to input something like this...
Quote:
Please input your student information:
KSU Id: 1234
First Name: Mary
Last Name: Jane
Midterm: 90
Final: 80
homework: 100
homework: 80
homework: 70
homework: 80
homework:
This is the first time I've ever had to deal with "Struct" and none of my reference materials tells me how malleable it is. Everything seems to indicate it's very simplistic...so do I have the ability to continually populate homework amounts? I can see the way the professor has it set up hitting enter with nothing on the homework line ends the cycle.
#3 - use those numbers to create a grade for the student, Midterm + Final * .4 + totalHomework / number homeworks * .2. I can do the math on that one easy enough..it's just figuring out how to pull out the homework numbers. Well, I could probably figure out how to pull them out, if I could figure out how to put them in.
Beyond that...everything else is gravy and easy. I'm just stumped on those three parts. If anyone can spare me some help, that'd be awesome and appreciated.
Here's the modified code to this point.
CODE
public struct Info
{
public string firstName;
public string lastName;
public int idNum;
//public int Midterm;
//public int Final;
public Info(string firstName, string lastName, int idNum)
{
this.firstName = firstName;
this.lastName = lastName;
this.idNum = idNum;
}
}
static void Main(string[] args)
{
List<Info> students = new List<Info>();
bool again = true;
Console.Clear();
Console.WriteLine("Please input your student information: ");
while (again)
{
bool dupIdNum = false;
Info newStudent = new Info();
Console.Write("\nFirst Name: ");
string firstName = Console.ReadLine();
newStudent.firstName = firstName;
Console.Write("Last Name: ");
string lastName = Console.ReadLine();
newStudent.lastName = lastName;
Console.Write("Id: ");
string input3 = Console.ReadLine();
int idNum = Convert.ToInt32(input3);
newStudent.idNum = idNum;
foreach (Info st in students)
{
if (st.idNum == newStudent.idNum)
{
dupIdNum = true;
Console.Write("KSU Id already exists in the system, please input a new one: ");
string newInput = Console.ReadLine();
int newIdNum = Convert.ToInt32(newInput);
newStudent.idNum = newIdNum;
continue;
}
else
continue;
}
if (dupIdNum == false)
students.Add(newStudent);
Console.WriteLine("\n\nMore Students? (y/n)");
char input4 = Console.ReadKey().KeyChar;
if (input4 == 'n')
again = false;
else if (input4 == 'y')
again = true;
else
{
Console.WriteLine("You have not entered a valid response. Goodbye.");
again = false;
}
}