-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFeedback.java
More file actions
21 lines (18 loc) · 795 Bytes
/
Feedback.java
File metadata and controls
21 lines (18 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package officialInternalAssessment;
public class Feedback {
public static String generateFeedback(int score, int totalQuestions, java.util.List<String> mistakes) {
StringBuilder sb = new StringBuilder();
sb.append("You scored ").append(score).append(" out of ").append(totalQuestions).append(".\n\n");
if (score == totalQuestions) {
sb.append("Excellent work! You got everything correct.\n");
} else if (score >= totalQuestions * 0.7) {
sb.append("Good job! Review the mistakes you made to improve");
} else {
sb.append("Keep practicing! Focus on your weak areas");
}
for (String m : mistakes) {
sb.append("- ").append(m).append("\n");
}
return sb.toString();
}
}