Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.IO;
- namespace AcademicTranscript
- {
- class Student
- {
- private string studentName;
- private int studentID;
- public string getName { get { return studentName; } }
- public int getID { get { return studentID; } }
- public Student (String sName, int sID)
- {
- studentName = sName;
- studentID = sID;
- }
- public void setName(string name)
- {
- if (name == null)
- {
- return;
- }
- studentName = name;
- }
- public void setID(int id)
- {
- if (id == null)
- {
- return;
- }
- studentID = id;
- }
- public void PrintStudent()
- {
- Console.WriteLine("Student Name: {0}\nStudent ID: {1}", getName, getID);
- }
- }
- class Course
- {
- private string course;
- private int credits;
- private double grade;
- private double[] gpa;
- public string getCourse { get { return course; } }
- public int getCredits { get { return credits; } }
- public double getGrade { get { return grade; } }
- public Course(String crse, int crd, double grd)
- {
- course = crse;
- credits = crd;
- grade = grd;
- }
- public void setCourse(string courses)
- {
- if (course == null)
- {
- return;
- }
- course = courses;
- }
- public void setCredits(int cred)
- {
- if (cred == null)
- {
- return;
- }
- credits = cred;
- }
- public void setGrade(double grades)
- {
- if (grades == null)
- {
- return;
- }
- grade = grades;
- }
- public void PrintCourses()
- {
- Console.WriteLine("Course: {0}\tCredits: {1} Grade: {2}", getCourse, getCredits, getGrade);
- }
- }
- class Quarter
- {
- private string quarter;
- private int year;
- public string getQuarter { get { return quarter; } }
- public int getYear { get { return year; } }
- public Quarter(String qtrs, int yrs)
- {
- quarter = qtrs;
- year = yrs;
- }
- public void PrintQuarter()
- {
- Console.WriteLine("Quarter: {0} of {1}", getQuarter, getYear);
- }
- }
- class Transcript
- {
- private Student[] studentArr;
- private Quarter[] quarterArr;
- private Course[] coursesArr;
- private int studentCount;
- private int quarterCount;
- private int courseCount;
- public Transcript(int maxLength)
- {
- studentArr = new Student[maxLength];
- quarterArr = new Quarter[maxLength];
- coursesArr = new Course[maxLength];
- studentCount = 0;
- quarterCount = 0;
- courseCount = 0;
- }
- public void AddStudent(Student students)
- {
- studentArr[studentCount] = students;
- studentCount++;
- }
- public void AddQuarter(Quarter quarters)
- {
- quarterArr[quarterCount] = quarters;
- quarterCount++;
- }
- public void AddCourse(Course courses)
- {
- coursesArr[courseCount] = courses;
- courseCount++;
- }
- public void PrintTranscript()
- {
- for (int i = 0; i < studentCount; i++)
- {
- studentArr[i].PrintStudent();
- }
- Console.WriteLine();
- for (int j = 0; j < quarterCount; j++)
- {
- quarterArr[j].PrintQuarter();
- Console.WriteLine();
- for (int k = 0; k < courseCount; k++)
- {
- coursesArr[k].PrintCourses();
- }
- Console.WriteLine();
- }
- }
- }
- class Program
- {
- static readonly int MAX_RECORDS = 1000;
- static int student_Count;
- static int transcript_Count = 0;
- static int input = 0;
- static void Main(string[] args)
- {
- int choice;
- int exitInput;
- string student_Name;
- int student_ID;
- string student_Quarter;
- string student_Course;
- int student_Credits;
- double student_Grade;
- Transcript transcript = new Transcript(MAX_RECORDS);
- Transcript transcript2 = new Transcript(MAX_RECORDS);
- Transcript[] transcript3 = new Transcript[100];
- string header = String.Format("\t\t\tCascadia Community College \n\t\t\tStudent Academic Transcript \n"
- + "\t\t\t---------------------------" + Environment.NewLine);
- transcript.AddStudent(new Student("Leif Svensson", 960019422));
- transcript.AddQuarter(new Quarter("Fall", 2012));
- transcript.AddCourse(new Course("Math 151", 5, 3.9));
- transcript.AddCourse(new Course("Phys 221", 5, 3.7));
- transcript.AddCourse(new Course("Econ 201", 5, 4.0));
- transcript2.AddQuarter(new Quarter("Winter", 2013));
- transcript2.AddCourse(new Course("Math 152", 5, 3.9));
- transcript2.AddCourse(new Course("Phys 222", 5, 3.7));
- transcript2.AddCourse(new Course("BIT 143", 5, 4.0));
- Console.WriteLine(header);
- transcript.PrintTranscript();
- transcript2.PrintTranscript();
- do
- {
- Console.Clear();
- Console.WriteLine(header);
- Console.WriteLine(Environment.NewLine + "\t\t\t ***Main Menu***\n");
- Console.WriteLine("\n1.) Add a Student");
- Console.WriteLine("\n2.) Add Quarter To Record");
- Console.WriteLine("\n3.) Display Transcripts");
- Console.WriteLine("\n4.) Search By Student ID");
- Console.WriteLine("\n5.) Exit The Program");
- Console.Write("\n\nEnter Your Choice: ");
- choice = Convert.ToInt32(Console.ReadLine());
- switch (choice)
- {
- case 1: //Add student record
- // Add student name / ID. Set to student array. Use student ID to categorize streamwriter array.
- Console.Clear();
- Console.WriteLine(header);
- Console.Write("\n\nEnter Name of Student: ");
- student_Name = Console.ReadLine();
- Console.Write("Enter Student ID: ");
- student_ID = Convert.ToInt32(Console.ReadLine());
- transcript3[transcript_Count] = new Transcript(MAX_RECORDS);
- transcript3[transcript_Count].AddStudent(new Student(student_Name, student_ID));
- /*students[student_Count] = new Student(first_Name, last_Name, student_ID);
- transcript[transcript_Count] = new Transcript();
- students[student_Count].setName(first_Name, last_Name);
- students[student_Count].setID(student_ID);
- transcript[transcript_Count].setQuarter(student_Quarter);
- transcript[transcript_Count].setCourse(student_Course);
- transcript[transcript_Count].setCredits(student_Credits);
- transcript[transcript_Count].setGrade(student_Grade);*/
- if (transcript_Count < 99)
- {
- transcript_Count++;
- }
- break;
- case 2: //Update student quarter
- // Add quarterly information to each student index.
- while (true)
- {
- Console.WriteLine("\n\nWould you like to add more courses?\n\nPress '1' for YES\nPress '2' for NO\n");
- string quartInput = Console.ReadLine();
- int qInput = Convert.ToInt32(quartInput);
- if (qInput == 1)
- {
- Console.Clear();
- Console.Write("Enter a Course: ");
- student_Course = Console.ReadLine();
- Console.Write("Enter the Amount of Credits: ");
- student_Credits = Convert.ToInt32(Console.ReadLine());
- Console.Write("Enter Grade: ");
- student_Grade = Convert.ToDouble(Console.ReadLine());
- /*transcript[student_Count].setQuarter(student_Quarter);
- transcript[student_Count].setCourse(student_Course);
- transcript[student_Count].setCredits(student_Credits);
- transcript[student_Count].setGrade(student_Grade);*/
- }
- else
- {
- break;
- }
- }
- break;
- case 3: //Display records
- Console.Clear();
- Console.WriteLine(header);
- transcript.PrintTranscript();
- transcript2.PrintTranscript();
- break;
- case 4: //Search by student ID
- break;
- }
- Console.WriteLine("\nWould you like to continue?\n\nPress '1' for YES\nPress '2' for NO" + Environment.NewLine);
- exitInput = Convert.ToInt32(Console.ReadLine());
- } while (exitInput == 1 || choice != 5);
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment