本文整理汇总了C#中Student.CalcAverageExamResultInPercents方法的典型用法代码示例。如果您正苦于以下问题:C# Student.CalcAverageExamResultInPercents方法的具体用法?C# Student.CalcAverageExamResultInPercents怎么用?C# Student.CalcAverageExamResultInPercents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Student
的用法示例。
在下文中一共展示了Student.CalcAverageExamResultInPercents方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
internal static void Main()
{
try
{
List<Exam> peterExams = new List<Exam>()
{
new SimpleMathExam(2),
new CSharpExam(55),
new CSharpExam(100),
new SimpleMathExam(1),
new CSharpExam(0),
};
Student peter = new Student("Peter", "Petrov", peterExams);
double peterAverageResult = peter.CalcAverageExamResultInPercents();
Console.WriteLine("Average results = {0:p0}", peterAverageResult);
}
catch (ArgumentOutOfRangeException aore)
{
Console.WriteLine(aore.Message);
}
catch (ArgumentNullException ane)
{
Console.WriteLine(ane.Message);
}
catch (ArgumentException ae)
{
Console.WriteLine(ae.Message);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
示例2: Main
static void Main()
{
var substr = Extensions.Subsequence("Hello!".ToCharArray(), 2, 5);
Console.WriteLine(substr);
var subarr = Extensions.Subsequence(new int[] { -1, 3, 2, 1 }, 0, 2);
Console.WriteLine(String.Join(" ", subarr));
var allarr = Extensions.Subsequence(new int[] { -1, 3, 2, 1 }, 0, 4);
Console.WriteLine(String.Join(" ", allarr));
var emptyarr = Extensions.Subsequence(new int[] { -1, 3, 2, 1 }, 0, 0);
Console.WriteLine(String.Join(" ", emptyarr));
Console.WriteLine(Extensions.ExtractEnding("I love C#", 2));
Console.WriteLine(Extensions.ExtractEnding("Nakov", 4));
Console.WriteLine(Extensions.ExtractEnding("beer", 4));
Console.WriteLine(Extensions.ExtractEnding("Hi", 100));
Extensions.CheckPrime(23);
Extensions.CheckPrime(33);
List<Exam> peterExams = new List<Exam>()
{
new SimpleMathExam(2),
new CSharpExam(55),
new CSharpExam(100),
new SimpleMathExam(1),
new CSharpExam(0),
};
Student peter = new Student("Peter", "Petrov", peterExams);
double peterAverageResult = peter.CalcAverageExamResultInPercents();
Console.WriteLine("Average results = {0:p0}", peterAverageResult);
}
示例3: TestingMethodCalcAverageExamResultInPercentsWithValidArgs
public void TestingMethodCalcAverageExamResultInPercentsWithValidArgs()
{
List<Exam> peterExams = new List<Exam>()
{
new SimpleMathExam(2),
new CSharpExam(55),
new CSharpExam(100),
new SimpleMathExam(1),
new CSharpExam(0),
};
Student peter = new Student("Peter", "Petrov", peterExams);
double peterAverageResult = peter.CalcAverageExamResultInPercents();
Assert.AreEqual(0.61d, peterAverageResult);
}
示例4: Main
static void Main()
{
var substring = Utils.Subsequence("Hello!".ToCharArray(), 2, 3);
Console.WriteLine(substring);
var subArray = Utils.Subsequence(new int[] { -1, 3, 2, 1 }, 0, 2);
Console.WriteLine(String.Join(" ", subArray));
var fullArray = Utils.Subsequence(new int[] { -1, 3, 2, 1 }, 0, 4);
Console.WriteLine(String.Join(" ", fullArray));
var emptyArray = Utils.Subsequence(new int[] { -1, 3, 2, 1 }, 0, 0);
Console.WriteLine(String.Join(" ", emptyArray));
Console.WriteLine(Utils.ExtractEnding("I love C#", 2));
Console.WriteLine(Utils.ExtractEnding("Nakov", 4));
Console.WriteLine(Utils.ExtractEnding("beer", 4));
Console.WriteLine(Utils.ExtractEnding("Hi", 100));
if (Utils.CheckPrime(23))
{
Console.WriteLine("23 is prime.");
}
else
{
Console.WriteLine("23 is not prime");
}
if (Utils.CheckPrime(33))
{
Console.WriteLine("33 is prime.");
}
else
{
Console.WriteLine("33 is not prime");
}
List<Exam> peterExams = new List<Exam>()
{
new SimpleMathExam(2),
new CSharpExam(55),
new CSharpExam(100),
new SimpleMathExam(1),
new CSharpExam(0),
};
Student peter = new Student("Peter", "Petrov", peterExams);
double peterAverageResult = peter.CalcAverageExamResultInPercents();
Console.WriteLine("Average results = {0:p0}", peterAverageResult);
}
示例5: Main
public static void Main()
{
var substr = Utilities.Subsequence("Hello!".ToCharArray(), 2, 3);
Console.WriteLine(substr);
var subarr = Utilities.Subsequence(new int[] { -1, 3, 2, 1 }, 0, 2);
Console.WriteLine(String.Join(" ", subarr));
var allarr = Utilities.Subsequence(new int[] { -1, 3, 2, 1 }, 0, 4);
Console.WriteLine(String.Join(" ", allarr));
var emptyarr = Utilities.Subsequence(new int[] { -1, 3, 2, 1 }, 0, 0);
Console.WriteLine(String.Join(" ", emptyarr));
Console.WriteLine(Utilities.ExtractEnding("I love C#", 2));
Console.WriteLine(Utilities.ExtractEnding("Nakov", 4));
Console.WriteLine(Utilities.ExtractEnding("beer", 4));
////Console.WriteLine(Utilities.ExtractEnding("Hi", 100));
Console.WriteLine("23 is prime => {0}", Utilities.CheckPrime(23));
Console.WriteLine("33 is prime => {0}", Utilities.CheckPrime(33));
////Console.WriteLine("23 is prime => {0}", Utilities.CheckPrime(-4));
Console.WriteLine();
Console.WriteLine("STUDENTS");
List<Exam> peterExams = new List<Exam>()
{
new SimpleMathExam(2),
new CSharpExam(55),
new CSharpExam(100),
new SimpleMathExam(1),
new CSharpExam(0),
};
Student peter = new Student("Peter", "Petrov", peterExams);
double peterAverageResult = peter.CalcAverageExamResultInPercents();
Console.WriteLine("Average results of Peter = {0:p0}", peterAverageResult);
List<Exam> katyExams = new List<Exam>()
{
};
Student katy = new Student("Katy", "Ken", katyExams);
double ketyAverageResult = katy.CalcAverageExamResultInPercents();
Console.WriteLine("Average results of Katy = {0:p0}", ketyAverageResult);
}
示例6: Main
static void Main()
{
var substr = Methods.Subsequence("Hello!".ToCharArray(), 2, 3);
Console.WriteLine(substr);
var subarr = Methods.Subsequence(new int[] { -1, 3, 2, 1 }, 0, 2);
Console.WriteLine(String.Join(" ", subarr));
var allarr = Methods.Subsequence(new int[] { -1, 3, 2, 1 }, 0, 4);
Console.WriteLine(String.Join(" ", allarr));
var emptyarr = Methods.Subsequence(new int[] { -1, 3, 2, 1 }, 0, 0);
Console.WriteLine(String.Join(" ", emptyarr));
Console.WriteLine(Methods.ExtractEnding("I love C#", 2));
Console.WriteLine(Methods.ExtractEnding("Nakov", 4));
Console.WriteLine(Methods.ExtractEnding("beer", 4));
try
{
Console.WriteLine(Methods.ExtractEnding("Hi", 100));
}
catch (ArgumentOutOfRangeException ex)
{
Console.WriteLine(ex.Message);
}
int primeCandidate1 = 23;
Methods.CheckPrime(primeCandidate1);
int primeCandidate2 = 33;
Methods.CheckPrime(primeCandidate2);
List<Exam> peterExams = new List<Exam>()
{
new SimpleMathExam(2),
new CSharpExam(55),
new CSharpExam(100),
new SimpleMathExam(1),
new CSharpExam(0),
};
Student peter = new Student("Peter", "Petrov", peterExams);
double peterAverageResult = peter.CalcAverageExamResultInPercents();
Console.WriteLine("Average results = {0:p0}", peterAverageResult);
}
示例7: Main
private static void Main()
{
var substr = MathUtils.Subsequence("Hello!".ToCharArray(), 2, 3);
Console.WriteLine(substr);
var subarr = MathUtils.Subsequence(new int[] { -1, 3, 2, 1 }, 0, 2);
Console.WriteLine(String.Join(" ", subarr));
var allarr = MathUtils.Subsequence(new int[] { -1, 3, 2, 1 }, 0, 4);
Console.WriteLine(String.Join(" ", allarr));
var emptyarr = MathUtils.Subsequence(new int[] { -1, 3, 2, 1 }, 0, 0);
Console.WriteLine(String.Join(" ", emptyarr));
Console.WriteLine(MathUtils.ExtractEnding("I love C#", 2));
Console.WriteLine(MathUtils.ExtractEnding("Nakov", 4));
Console.WriteLine(MathUtils.ExtractEnding("beer", 4));
Console.WriteLine(MathUtils.ExtractEnding("Hi", 100));
var validPrime = 23;
try
{
var isPrime = MathUtils.CheckPrime(validPrime);
Console.WriteLine(validPrime + " is prime: " + isPrime);
}
catch (ArgumentException ex)
{
Console.WriteLine(ex.Message);
}
var invalidNumber = -23;
try
{
var isPrime = MathUtils.CheckPrime(invalidNumber);
Console.WriteLine(validPrime + " is prime: " + isPrime);
}
catch (ArgumentException ex)
{
Console.WriteLine(ex.Message);
}
try
{
List<Exam> peterExams = new List<Exam>()
{
new SimpleMathExam(2),
new CSharpExam(55),
new CSharpExam(100),
new SimpleMathExam(1),
new CSharpExam(0),
};
Student peter = new Student("Peter", "Petrov", peterExams);
double peterAverageResult = peter.CalcAverageExamResultInPercents();
Console.WriteLine("Average results = {0:p0}", peterAverageResult);
}
catch (ArgumentException ae)
{
Console.WriteLine(ae.Message);
}
}
示例8: Main
public static void Main()
{
/// test Subsequence
var charArray = "Hello!".ToCharArray();
try
{
var substr = charArray.Subsequence(2, 3);
Console.WriteLine(substr);
}
catch (ArgumentOutOfRangeException exception)
{
Console.WriteLine(exception.Message);
}
var intArray = new int[] { -1, 3, 2, 1 };
try
{
var subarr = intArray.Subsequence(3, 2);
Console.WriteLine(string.Join(" ", subarr));
}
catch (ArgumentOutOfRangeException exception)
{
Console.WriteLine(exception.Message);
}
try
{
var allarr = intArray.Subsequence(0, 4);
Console.WriteLine(string.Join(" ", allarr));
}
catch (ArgumentOutOfRangeException exception)
{
Console.WriteLine(exception.Message);
}
try
{
var emptyarr = intArray.Subsequence(0, 0);
Console.WriteLine(string.Join(" ", emptyarr));
}
catch (ArgumentOutOfRangeException exception)
{
Console.WriteLine(exception.Message);
}
/// Test ExtractEnding
Console.WriteLine("I love C#".ExtractEnding(2));
Console.WriteLine("Nakov".ExtractEnding(4));
Console.WriteLine("beer".ExtractEnding(4));
Console.WriteLine("Hi".ExtractEnding(100));
/// Test CheckIfPrime
int number = 23;
if (number.CheckIfPrime())
{
Console.WriteLine("{0} is prime.", number);
}
else
{
Console.WriteLine("{0} is not prime", number);
}
number += 10;
if (number.CheckIfPrime())
{
Console.WriteLine("{0} is prime.", number);
}
else
{
Console.WriteLine("{0} is not prime", number);
}
/// Test Exams classes
List<Exam> peterExams = new List<Exam>()
{
new SimpleMathExam(2),
new CSharpExam(55),
new CSharpExam(100),
new SimpleMathExam(1),
new CSharpExam(0),
};
Student peter = new Student("Peter", "Petrov", peterExams);
Student georgi = new Student("Georgi", "Georgiev");
try
{
double peterAverageResult = peter.CalcAverageExamResultInPercents();
Console.WriteLine("{1}: Average results = {0:p0}", peterAverageResult, peter.LastName);
double georgiAverageResult = georgi.CalcAverageExamResultInPercents();
Console.WriteLine("{1}: Average results = {0:p0}", georgiAverageResult, georgi.LastName);
}
catch (StudentExamsNotFoundException noExamsException)
{
Console.WriteLine(noExamsException.Message);
}
}
示例9: TestingMethodCalcAverageExamResultInPercentsWithNoExams
public void TestingMethodCalcAverageExamResultInPercentsWithNoExams()
{
List<Exam> peterExams = new List<Exam>();
Student peter = new Student("Peter", "Petrov", peterExams);
double peterAverageResult = peter.CalcAverageExamResultInPercents();
}
示例10: TestingMethodCalcAverageExamResultInPercentsWithNullAsExams
public void TestingMethodCalcAverageExamResultInPercentsWithNullAsExams()
{
Student peter = new Student("Peter", "Petrov", null);
double peterAverageResult = peter.CalcAverageExamResultInPercents();
}