Assignment No. 2
Assignment No. 2
Instructions
1. Understanding the problems is part of the assignment. So, no query, please.
2. You will get zero marks if found any type of plagiarism.
3. No submission after due date.
4. Upload pdf file containing scan of handwritten assignment.
5. Include your name, SAP ID, section and task number as cout statements or comment in each program.
Task 1: Mr. Tabish, an enthusiastic mathematics teacher, is excited to test his students in an
engaging way. He believes he has effectively taught them mathematical concepts and now wants
to challenge them with a game. In this game, students will choose a number between 2 and 30.
Depending on whether the chosen number is even or odd, they will be given different tasks to
complete. [2.5]
Game Rules:
1. If the student chooses an even number, first they need to compute the square of that
even number, and then they must determine whether the square is also within the range of
2 and 30 or not.
2. If the student chooses an odd number, they must determine whether the number is
prime or not. If it is not prime, then they should check whether the number is divisible
by 3 or not.
As a student of Programming Fundamentals, apply C++ to help Mr. Tabish in converting his
written plan into a console game.
Task 2: Mr. Nadeem, a dedicated teacher, wants to develop a Student Performance Tracker
for his class of 5 students across 3 subjects (Math, Science, and English). He needs a program
to: [2.5]
1. Store student names in a 1D array.
2. Store marks in a 2D array, where each row represents a student, and each column
represents a subject.
3. Calculate total and average marks for each student.
4. Identify the highest scorer in the class.
5. Display the report in a structured format.
Sample Output:
Task 3: A city's emergency call center receives distress calls, each assigned a priority code
based on urgency (lower number = more urgent).
1. Capable to store 100 priority codes. But the number of received calls and their priority
numbers may vary at different times.
2. Sort all received priority codes in ascending order (most urgent cases first).
3. Allow the supervisor to search for a specific priority code to check its status. [2.5]
Sample Output: