2-js-basics/3-making-decisions/assignment.md
In this assignment, you'll practice the decision-making concepts from this lesson by building a program that processes student grades from different grading systems. You'll use if...else statements, comparison operators, and logical operators to determine which students pass their courses.
You work for a school that recently merged with another institution. Now you need to process student grades from two completely different grading systems and determine which students are passing. This is a perfect opportunity to practice conditional logic!
A, A-, B, B-, C, C-A, A-, B, B-, C, C- (all listed grades are passing)D or FGiven the following array allStudents representing all students and their grades, construct a new array studentsWhoPass containing all students who pass according to their respective grading systems.
let allStudents = [
'A', // Letter grade - passing
'B-', // Letter grade - passing
1, // Numeric grade - failing
4, // Numeric grade - passing
5, // Numeric grade - passing
2 // Numeric grade - failing
];
let studentsWhoPass = [];
allStudents arraystudentsWhoPass arrayUse these JavaScript concepts from the lesson:
typeof grade === 'number' to check if it's a numeric grade>= to compare numeric grades|| to check multiple letter grade conditions.push() to add passing grades to your new arrayWhen you run your program, studentsWhoPass should contain: ['A', 'B-', 4, 5]
Why these grades pass:
'A' and 'B-' are valid letter grades (all letter grades in this system are passing)4 and 5 are numeric grades >= 31 and 2 fail because they're numeric grades < 3Test your code with different scenarios:
// Test with different grade combinations
let testGrades1 = ['A-', 3, 'C', 1, 'B'];
let testGrades2 = [5, 'A', 2, 'C-', 4];
// Your solution should work with any combination of valid grades
Once you complete the basic assignment, try these extensions:
| Criteria | Exemplary (4) | Proficient (3) | Developing (2) | Beginning (1) |
|---|---|---|---|---|
| Functionality | Program correctly identifies all passing grades from both systems | Program works with minor issues or edge cases | Program partially works but has logical errors | Program has significant errors or doesn't run |
| Code Structure | Clean, well-organized code with proper if...else logic | Good structure with appropriate conditional statements | Acceptable structure with some organizational issues | Poor structure, difficult to follow logic |
| Use of Concepts | Effectively uses comparison operators, logical operators, and conditional statements | Good use of lesson concepts with minor gaps | Some use of lesson concepts but missing key elements | Limited use of lesson concepts |
| Problem Solving | Shows clear understanding of the problem and elegant solution approach | Good problem-solving approach with solid logic | Adequate problem-solving with some confusion | Unclear approach, doesn't demonstrate understanding |
['A', 'B-', 4, 5]💡 Pro Tip: Start simple! Get the basic functionality working first, then add more sophisticated features. Remember, the goal is to practice decision-making logic with the tools you learned in this lesson.