IP Lab-Final Term Assignment FALL 2024-2025
IP Lab-Final Term Assignment FALL 2024-2025
Note: Output screenshot files can be jpg/jpeg, png …... any valid image format).
1. Imagine you are managing the weekly sales data for different branches of a retail store. Each row in the 2D array
represents a branch, and each column represents the sales for a day of the week. You need to write a C++ program to
initialize this sales data, display it, and calculate the row-wise sum and average of the sales using functions.
Requirements:
• Use functions for the operations.
• The sales data should be represented as a 2D array.
• Display the sales data in a tabular format.
• Calculate and display the sum and average sales for each branch.
• Sample inputs:
• Branch 1: 1200, 1500, 1100, 1400, 1300, 1600, 1700
• Branch 2: 1000, 1100, 1200, 1300, 1400, 1500, 1600
• Branch 3: 900, 1000, 1100, 1200, 1300, 1400, 1500
• Sample outputs:
• Sales Data (Branches x Days):
• 1200 1500 1100 1400 1300 1600 1700
• 1000 1100 1200 1300 1400 1500 1600
• 900 1000 1100 1200 1300 1400 1500
2. Write one struct named Teacher, take teacherID, teacherName and salary as variables with
appropriate types. Provide necessary methods inside the struct to set, get, display the values and
write another method named yearlySalary that displays the yearly salary of the Teacher. Inside the
main method, create an instance of the struct named t1 and demonstrate the use of all the methods.
3. Write one class named Teacher, take teacherID, teacherName and salary as variables with
appropriate types and most appropriate access modifier for data security. Provide necessary public
constructors and methods inside the class to set, get, display the values and write another method
named yearlySalary that displays the yearly salary of the Teacher. Inside the main method, create
two instances of the class named t1 and t2 and demonstrate the use of all the constructors and
methods.