So I've been assigned a little project in which I need to take information from students, enter it into a simple console application, and when asked to continue, hit no, and then boom, all of the information magically appears in the window. I'm asking for simple information:
First Name, Last Name, DOB, Student ID, Number of Classes, Graduation Year.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MidtermWeek5
{
class Program
static void Main(string[] args)
//VARIABLE AREA
bool isContinued = true;
int listCount = 0;
List<string> firstName = new List<string>();
List<string> lastName = new List<string>();
List<int> studentID = new List<int>();
List<int> classCount = new List<int>();
List<int> graduateYear = new List<int>();
while (isContinued)
//COLLECT DATA AREA
Console.WriteLine("Please enter your first name:");
firstName.Add(Console.ReadLine());
Console.WriteLine("Please enter your last name:");
lastName.Add(Console.ReadLine());
Console.WriteLine("Please enter your student ID (XXXX):");
studentID.Add(Convert.ToInt32(Console.ReadLine()));
Console.WriteLine("Please enter your number of classes:");
classCount.Add(Convert.ToInt32(Console.ReadLine()));
Console.WriteLine("Please enter your graduation year:");
graduateYear.Add(Convert.ToInt32(Console.ReadLine()));
//CHECK USER TO CONTINUE
Console.WriteLine("Do you want to continue (Y/N)?");
if (Console.ReadLine().ToUpper() == "Y")
isContinued = true;
Console.Clear(); //clear screen
}
else
isContinued = false;
//DISPLAY RESULTS AREA
Console.WriteLine("{0, -9} {1, -8} {2, -10} {3, -8} {4, -15}", "First", "Last", "Student ID", "Classes", "Graduate Year");
Console.WriteLine("-------------------------------------------------------------------------------");
listCount = firstName.Count;
while (listCount > 0)
Console.WriteLine("{0, -9} {1, -8} {2, -10} {3, -8} {4, -15}", firstName[listCount - 1], lastName[listCount - 1], studentID[listCount - 1], classCount[listCount - 1], graduateYear[listCount - 1]);
listCount--;
//KEEP THE SCREEN ON
Console.ReadLine();
Console.WriteLine("{0, -9} {1, -8} {2, -12} {3, -10} {4, -8} {5, -15}", "First", "Last", "DOB", "Student ID", "Classes", "Graduate Year");
Console.WriteLine("{0, -9} {1, -8} {2, -12} {3, -10} {4, -8} {5, -15}", firstName[listCount - 1], lastName[listCount - 1], birthday[listCount - 1], studentID[listCount - 1], classCount[listCount - 1], graduateYear[listCount - 1]);