0% found this document useful (0 votes)
32 views3 pages

PF - Assignment 1

Pf Assignments
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)
32 views3 pages

PF - Assignment 1

Pf Assignments
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/ 3

National University of Modern Languages

FAISALABAD CAMPUS
Department of SE / IT
Assignment 1 (CLO-1)
FALL-2024 Marks: 10
Class: BSSE-1st (A&B) Course: Programming Fundamental

Note: A hand written neat & clean solution file attempted on assignment pages will be submitted to
th
CR or GR (in case of their absence directly to my office) during university time till Monday dated 14 ,
October 2024 (1:45 p.m.). However, solution files after marking will be uploaded on LMS as
early as possible once returned to you.

 Late submission will not be considered


 Everyone should work individually and Copied solution will be awarded as ‘F’ grade

For the solution of Question 1, use the given symbols

Question 1:
Part A: Develop an algorithm and model a flowchart that will read the Length and Width of a
rectangle and calculate its area.
Part B: Develop an algorithm and model a flowchart for a program that finds the average of five
numbers.
Page 1 of 3
National University of Modern Languages
FAISALABAD CAMPUS
Department of SE / IT
Assignment 1 (CLO-1)
Question 2:
Part A: Develop a C++ program to calculate the bonus amount for an employee based on his
grade and display his total salary. Prompt the user to input the grade of the employee and their
basic salary. Calculate the bonus amount according to different grades and display the total
salary including the bonus. If the grade will be from 1 to 10 then 15% bonus will be added in his
basic salary, but if the grade will be from 11 to 16 then 10% bonus will be added and if the grade
will be from 16 to 22 then 7% bonus will added in salary.

Part B: Solve the given expressions using the concept of operator precedence in C++:

i. 10 * (5 + 3) - 6 / 2
ii. (10 - 4) * 2 / (3 + 1)
iii. 2 + 3 * 4 / 2 - (4 % 3)
iv. 5 * (++a - b--), where a = 3 and b = 2
v. 20 / (4 * 2) + (5%3)

Page 2 of 3
National University of Modern Languages
FAISALABAD CAMPUS
Department of SE / IT
Assignment 1 (CLO-1)
Question 3: Your task is to identify and correct the errors in the provided C++ code. The
program is intended to that checks if a given year is a leap year.

Instructions:

1. Review the provided code carefully.


2. Identify any syntax, logical, or runtime errors.
3. Correct the code to ensure it compiles and functions correctly.
4. Explain the changes you made.

#include <iostreem>
#using namespaces std;

int main() {
int year;
cout << "Enter a year: ";
cin >> years;
if (year % 4 = 0)
if (year % 100 == 0)
if (year % 400 == 0)
cout << year << " is a leap year." << endl;
else
cout << year << " is not a leap year." << endl;
else
cout << year << " is a leap year." << endl;
else
cout << year << " is not a leap year." << endl;
return 0
}

Page 3 of 3

You might also like