74.4k views
3 votes
Consider the following table used for grading assignments.

Score in points Grade
90-100 A
80-89 B
70-79 C
60-69 D
59 and below F
Your task is to test a course assessment utility that uses the criteria given above. List the valid and invalid equivalent partitions and give the test cases for each. Your test cases are required to incorporate boundary value testing.

User Adi Mor
by
5.1k points

1 Answer

4 votes

Answer:

We can use if-else statements to implement the given problem.

C++ Code:

#include <iostream>

using namespace std;

int main()

{

int marks;

cout<<"Enter the marks"<<endl;

cin>>marks;

if (marks>=90 && marks<=100)

{

cout<<"Grade: A"<<endl;

}

else if (marks>=80 && marks<=89)

{

cout<<"Grade: B"<<endl;

}

else if (marks>=70 && marks<=79)

{

cout<<"Grade: C"<<endl;

}

else if (marks>=60 && marks<=69)

{

cout<<"Grade: D"<<endl;

}

else if (marks>=0 && marks<=59 )

{

cout<<"Grade: F"<<endl;

}

else

{

cout<<"Invalid marks!"<<endl;

}

return 0;

}

Test results:

Enter the marks

100

Grade: A

Enter the marks

90

Grade: A

Enter the marks

89

Grade: B

Enter the marks

80

Grade: B

Enter the marks

79

Grade: C

Enter the marks

70

Grade: C

Enter the marks

69

Grade: D

Enter the marks

60

Grade: D

Enter the marks

59

Grade: F

Enter the marks

45

Grade: F

Enter the marks

105

Invalid marks!

Enter the marks

-6

Invalid marks!

Hence all the cases are working fine!

Consider the following table used for grading assignments. Score in points Grade 90-100 A-example-1
Consider the following table used for grading assignments. Score in points Grade 90-100 A-example-2
Consider the following table used for grading assignments. Score in points Grade 90-100 A-example-3
Consider the following table used for grading assignments. Score in points Grade 90-100 A-example-4
User Tom Neyland
by
5.0k points