0% found this document useful (0 votes)
2 views

Assignment 3

The document outlines an assignment consisting of 12 programming tasks focused on various C++ concepts such as functions, macros, pointers, and arrays. Each task presents a specific scenario, including employee salary management, product discount calculation, and voting eligibility check, requiring the implementation of different programming techniques. The submission guidelines specify the need for source code, testing, and a deadline of December 27, 2024.

Uploaded by

haleemasadia0024
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Assignment 3

The document outlines an assignment consisting of 12 programming tasks focused on various C++ concepts such as functions, macros, pointers, and arrays. Each task presents a specific scenario, including employee salary management, product discount calculation, and voting eligibility check, requiring the implementation of different programming techniques. The submission guidelines specify the need for source code, testing, and a deadline of December 27, 2024.

Uploaded by

haleemasadia0024
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Assignment 3

1. Employee Salary Management System (Using Functions and


Macros)

Scenario: You are tasked with creating a salary management system


where:

 Each employee gets a 10% bonus if their salary is less than a


threshold (using a macro).

 Use functions to calculate the updated salary and display it.

 Use a function prototype.

2. Product Discount Calculator (Passing by Value & Reference)

Scenario: A shopping app calculates the discounted price of a product.

 Pass the original price by value and discount percentage by


reference.

 Use functions to calculate the final price.

 Demonstrate the difference between value and reference changes.

3. Bank Account Balance Checker (Default Arguments)

Scenario: Create a function that checks whether an account is eligible for


a loan.

 Use default arguments: the minimum balance threshold is 10,000.

 Accept current account balance and loan eligibility flag.

 Return a boolean value indicating eligibility.

4. Stock Price Analytics (Inline Functions)

Scenario: Develop a stock analysis program where:

 Inline functions calculate the percentage gain/loss on stock prices.

 Input the purchase price and current price of a stock.

 Display the gain/loss percentage for multiple stocks.

5. Student Grade Evaluation (Function Overloading)

Scenario: Write a program to calculate the grades of students using


function overloading:

1. Calculate grade based on total marks.

2. Calculate grade based on subject-wise marks.


3. Calculate grade based on attendance and performance ratings.

6. Voting Eligibility Check (Global and Local Variables)

Scenario: Create a program to verify voter eligibility.

 Use a global variable for the minimum voting age.

 Use local variables for voter age and citizenship.

 Include a function that checks and displays eligibility based on these


variables.

7. Dynamic Memory Allocation for Exam Marks (Pointers)

Scenario: Input marks for n subjects using pointers.

 Calculate the highest, lowest, and average marks.

 Demonstrate pointer arithmetic to access marks dynamically.

 Use a function to perform each operation.

8. Matrix Diagonal Sum (2-D Arrays with Pointers)

Scenario: Create a function to calculate the sum of diagonals of a square


matrix.

 Input a dynamic 2-D matrix using pointers.

 Return the sum of the primary and secondary diagonals.

9. Vehicle Mileage Tracker (Static Local Variables)

Scenario: Create a mileage tracker for vehicles:

 Use a function to input daily mileage for a vehicle.

 Use a static local variable to keep track of total mileage.

 Display cumulative mileage for 7 days.

10. Temperature Monitoring System (Pointer to Arrays)

Scenario: Develop a program to monitor daily temperatures of a city:

 Use a pointer to an array to input temperatures for a week.

 Use functions to calculate and display the average, highest, and


lowest temperatures.

11. Teacher Attendance Record (Array of Pointers)

Scenario: A university records attendance for n teachers.


 Use an array of pointers to store teacher names dynamically.

 For each teacher, input and display their attendance


(present/absent).

 Use a function to display attendance percentage.

12. Power Plant Efficiency Monitoring (Macros vs Functions)

Scenario: Compare efficiency calculation using:

1. A macro for quick efficiency calculation.

2. A function to calculate efficiency with input validation.

 Input power generated and power consumed.

 Compare the results for multiple readings.

Submission Guidelines:

 Submit the C++ source code for each task.


 Ensure that the program compiles and runs without errors.
 For each program, test it with multiple inputs and write down the
expected outcome.
 Handwritten Assignment snapshoots as pdf on Slate.
 Deadline: 27th December 2024.

You might also like