//Function-> this function reads in the information from an input file and populates the chart with that info public void ReadInfoIntoChart() { //go to the file and extract the X and Y points string line; string StudentA, StudentB, StudentC, StudentD; using (StreamReader inFile = new StreamReader("../../GradePercentsOnAssigns.txt")) { while ((line = inFile.ReadLine()) != null) { //each student is split by a tab, each test score per student is split by ":" //split the lines by a comma (since input goes X,Y) string[] Students = line.Split('\t'); //get each student's test scores StudentA = Students[0]; StudentB = Students[1]; StudentC = Students[2]; StudentD = Students[3]; //now split each student by the colons since each test score is separated by that string[] StudentAScores = StudentA.Split(':'); string[] StudentBScores = StudentB.Split(':'); string[] StudentCScores = StudentC.Split(':'); string[] StudentDScores = StudentD.Split(':'); //call function above to go through each student's test & score array //and populate the correct values into the points for the chart StudentAPoints = createDataPoints(StudentAScores); StudentBPoints = createDataPoints(StudentBScores); StudentCPoints = createDataPoints(StudentCScores); StudentDPoints = createDataPoints(StudentDScores); } } }
static void Main(string[] args) { Console.WriteLine("甲学生抄的试卷"); TestPaper studentA = new StudentA(); studentA.TestQuestion1(); studentA.TestQuestion2(); studentA.TestQuestion3(); Console.WriteLine("乙学生抄的试卷"); TestPaper studentB = new StudentB(); studentB.TestQuestion1(); studentB.TestQuestion2(); studentB.TestQuestion3(); Console.ReadKey(); }
static void Main(string[] args) { // BankA bankA = new BankA(); // bankA.getBalance(); // BankB bankB = new BankB(); // bankB.getBalance(); // BankC bankC = new BankC(); // bankC.getBalance(); int[] studentAMarks = { 20, 30, 60 }; StudentA studentA = new StudentA(studentAMarks); studentA.getPercentage(); int[] studentBMarks = { 20, 30, 60, 90 }; StudentB studentB = new StudentB(studentBMarks); studentB.getPercentage(); }
public async Task <IActionResult> ImportCSVFile() { //template method pattern example DataReader daoStudentsA = new StudentA(_context); daoStudentsA.Run(this._option1); DataReader daoStudentsB = new StudentB(_context); daoStudentsB.Run(this._option1); //repository pattern example List <Student> students = new List <Student>(); students = _fileReader.ReadCSVFile(this._option1); if (students.Count() == 0) { return(BadRequest("Data are empty.")); } _fileReader.ImportStudents(students); return(Ok()); }
public StudentController() { objStudent = new StudentB(); }