Advertisement
khaiwen1111

Practical 4 Part B question 2

Jul 5th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1. public Student(string theName)
  2. {
  3.     name = theName;
  4.     testScores = new double[4];
  5. }
  6.  
  7. public void SetATestScore( int testNumber, double score)
  8. {
  9.     testScores[testNumber] = scores;
  10. }
  11.  
  12. using System;
  13. public class StudentTest2
  14. {
  15.     public static void Main()
  16.     {
  17.         Student student = new Student("Joe");
  18.  
  19.         student.SetATestScore(0, 100.0);
  20.         student.SetATestScore(1, 90.0);
  21.         student.SetATestScore(2, 90.0);
  22.         student.SetATestScore(3, 100.0);
  23.  
  24.         Console.WriteLine("Average for {0} is {1:F1}", student.Name,
  25.                                                        student.ComputeAverage());
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement