CS3018 PL SET A 5to7

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

B.V.

PATEL INSTITUTE OF COMPUTER SCIENCE 2024-2025

Practical:05 SET A Enrolment No.:


Problem A. A company gives bonuses to its employees based on their years of service and
Definition performance rating. The conditions are:

 If the employee has worked for more than 10 years and has a rating of 5, they get a
bonus of 20% of their salary.
 If the employee has worked for more than 10 years and has a rating of less than 5,
they get a bonus of 10%.
 If the employee has worked for less than 10 years but more than 5 years and has a
rating of 5, they get a bonus of 15%.
 If none of these conditions are met, they get no bonus.

Write a program that inputs the employee’s years of service, performance rating, and
salary, then calculates and displays the bonus of an employee as shown in Sample input
and output section.

B. An e-commerce website calculates shipping costs based on the type of product and
delivery speed. Products are classified into Electronics, Clothing, and Groceries. The
delivery speeds are Standard, Express, and Same-Day Delivery. The cost for each
product and delivery type is as follows:

 Electronics: Standard (₹50), Express (₹100), Same-Day (₹200)


 Clothing: Standard (₹30), Express (₹70), Same-Day (₹150)
 Groceries: Standard (₹20), Express (₹50), Same-Day (₹100)

Write a program that takes the product type and delivery speed as input and uses a switch
statement to calculate and display the total shipping cost.

Pre-requisite if…else, if…elseif…else, nested if statements, switch statements


Objective(s): To implement the conditional statement namely if...else, if…elseif and nested if statements,
switch for solving the problem.
Duration for 03 Hours
completion
Solution Algorithm, Flowchart, and respective language source code along with sample calculation for each
must contain sub practical’s.
Sample A. Sample IP 1 :
Input and Enter the years of service: 12
Enter the performance rating (out of 5): 5
Output
Enter the employee's salary: 50000
Sample OP 1 : The bonus for the employee is: ₹10000.00

Evaluation Evaluation Criteria Marks [15 M] Secured by Student


Complete Solution 3
Correctness of Solution 4
Utilization of nested if and 3
switch statements
Viva 5
Teacher’s Signature & Date

JENISHA TAILOR, PRIYANKA PATEL 10


B.V. PATEL INSTITUTE OF COMPUTER SCIENCE 2024-2025

Practical:06 SET A Enrolment No.:


Problem A. Write an algorithm for any one of the following series. Write a program to display first N
Definition terms of each of the following series:
B. 1, 4, 9, 16, 25, 36…
C. 5,9,17, 29, 45, 65…
B. Write a program that takes an integer n as input and uses a loop to calculate the
factorial of n. Display the factorial value.
C. Write the output for the following programs along with sample calculation. Also
convert the following code into while statement:
#include <iostream> #include <iostream>
using namespace std; using namespace std;
int main() int main()
{ {
int a = 0, i = 0; for (int i = 122; i >= 97; --i)
for (i = 0;i < 9999; i++) cout << (char) i <<endl;
{ return 0;
a++; }
if (i == 5)
break;
}
cout<<a;
}

D. Write an algorithm and a program from following flowchart.

JENISHA TAILOR, PRIYANKA PATEL 11


B.V. PATEL INSTITUTE OF COMPUTER SCIENCE 2024-2025

Pre-requisite Loop -- for, while and do..while statements


Objective(s): To apply the simple loop statement in developing the programs using numeric data.
Duration for 03 Hours
completion
Solution Algorithm, Flowchart, and respective language source code along with sample calculation for each
must contain sub practical’s.
Sample --
Input and
Output
Evaluation Evaluation Criteria Marks [15 M] Secured by Student
Complete Solution 3
Correctness of Solution 4
Use of Loop, nestedLoop 3
Viva 5
Teacher’s Signature & Date

JENISHA TAILOR, PRIYANKA PATEL 12


B.V. PATEL INSTITUTE OF COMPUTER SCIENCE 2024-2025

Practical:07 SET A Enrolment No.:


Problem A. Write a program that displays the following pattern using do…while statement.
Definition If the user inputs 5 then display:
* * 1
* * * * BC
* * * * * * 345
* * * * * * * * DEFG
* * * * * * * * * 56789
A. Write a menu-driven program for a temperature converter that displays the
following menu with its functionality:
1. Convert Celsius to Fahrenheit
2. Convert Fahrenheit to Celsius
3. Exit
Functionality:
1. Convert Celsius to Fahrenheit: When the user selects option 1, prompt them to enter
the temperature in Celsius and display the converted temperature in Fahrenheit.
2. Convert Fahrenheit to Celsius: When the user selects option 2, prompt them to enter
the temperature in Fahrenheit and display the converted temperature in Celsius.
3. Exit: When the user selects option 3, terminate the program.
Pre-requisite Loop -- for, while and do..while statements, nested loop
Objective(s): To apply the simple loop statement in developing the programs using numeric data.
Duration for 03 Hours
completion
Solution Algorithm, Flowchart, and respective language source code along with sample calculation for each
must contain sub practical’s.
Sample
Input and
Output
Evaluation Evaluation Criteria Marks [15 M] Secured by Student
Complete Solution 3
Correctness of Solution 4
Use of Loop, nested Loop 3
Viva 5
Teacher’s Signature & Date

JENISHA TAILOR, PRIYANKA PATEL 13

You might also like