o-cl®RP:Baic Programming 2: Working with Parameter Types Parameterized Construct
ID: 3732733 • Letter: O
Question
o-cl®RP:Baic Programming 2: Working with Parameter Types Parameterized Constructor-Trainee (stringl 1, float D The constructor should initialize the member variables TocusArea' and 'marks' with appropriate values CalculateScorefout float percentage,out char grade.out string message Jbool isRetest false) method . This method returns the total score and assigns the values of different parameters as per the rules mentioned . Score should be calculated as a sum of all focus area marks. If the value of isRetest parameter is true, thern a penalty of 10% should be applied on the total score For calculating the percentage, the maximum marks of each focus area should be considered as 100 . The value of the out parameters 'grade' and 'message' should be determined as per the rules mentioned Percentage -85 and -0 andExplanation / Answer
public float CalculateScore (out float percentage, out string message ,bool isRetest=false){
if(isRestest == true)
{
marks=100-10/100*marks;
}
else
{
if(percentage>=85 && percentage <=100)
{
Grade='A',Message='Qualified'
}
elseif(percentage>=75 && percentage <=84)
{
Grade='B',Message='Qualified'
}
elseif(percentage>=0 && percentage <=74)
{
if (percentage>=50)
{
Grade='C',Message='Qualified'
}else
{
Grade='N',Message='NOT Qualified'
}
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.