0% found this document useful (0 votes)
15 views2 pages

Assignment No. 2

The document outlines an assignment for Programming Fundamentals at the University of Lahore, detailing three tasks to be completed using C++. Task 1 involves creating a console game based on students' number choices, Task 2 requires developing a Student Performance Tracker for five students across three subjects, and Task 3 focuses on managing emergency call priority codes. Students must submit a handwritten PDF with specific details and adhere to guidelines regarding plagiarism and submission deadlines.

Uploaded by

numer6549
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views2 pages

Assignment No. 2

The document outlines an assignment for Programming Fundamentals at the University of Lahore, detailing three tasks to be completed using C++. Task 1 involves creating a console game based on students' number choices, Task 2 requires developing a Student Performance Tracker for five students across three subjects, and Task 3 focuses on managing emergency call priority codes. Students must submit a handwritten PDF with specific details and adhere to guidelines regarding plagiarism and submission deadlines.

Uploaded by

numer6549
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

The University of Lahore, Department of CS & IT

Programming Fundamentals – Assignment # 02


Start Date: Monday 24/03/2025 Total Marks: 10
Due Date: Sunday 30/03/2025 Program: BSCS

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:

Enter names of 5 students:


Ali, Sara, Ahmed, Fatima, Usman

Enter marks for Ali (Math, Science, English): 78 85 90


Enter marks for Sara (Math, Science, English): 82 79 88
Enter marks for Ahmed (Math, Science, English): 90 92 85
Enter marks for Fatima (Math, Science, English): 76 81 87
Enter marks for Usman (Math, Science, English): 85 89 91

Student Performance Report:


---------------------------------------------
Name Math Science English Total Average
Ali 78 85 90 253 84.33
Sara 82 79 88 249 83.00
Ahmed 90 92 85 267 89.00
Fatima 76 81 87 244 81.33
Usman 85 89 91 265 88.33
---------------------------------------------
Top Scorer: Ahmed with 267 marks.

Task 3: A city's emergency call center receives distress calls, each assigned a priority code
based on urgency (lower number = more urgent).

To ensure critical emergencies are handled first, the system must:

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:

Enter the number of emergency calls received: 6


Enter priority codes: 45 12 78 30 22 55

Sorted priority codes (Most urgent first): 12 22 30 45 55 78

Enter priority code to search: 30


Emergency with priority 30 found at index 2!

Enter priority code to search: 99


Emergency with priority 99 not found!

You might also like