PF LAB 03 (Conditional Statements)
PF LAB 03 (Conditional Statements)
Lab Manual # 3
Programming Fundamentals
(Section BCS-2A1&2A2)
Objective:
After performing this lab, students shall be able to:
• Usage of Input/output statements
• Conditional Structures o If- selection statement o If-else statement o Nested if statement o Switch
statement
Question#2 (5 marks)
Write a C++ program that calculates the cashback amount. If user total purchasing bill is greater than 1000,
then it is eligible for cashback, otherwise not. If user is eligible for cashback then cashback is calculated
via (purchasing bill * 10/100). If cashback is greater than 200, then it is multiplied by the 2, otherwise not.
In last it should display the cashback.
Sample:
Question#3 (5 marks)
(Switch statement) Write a C++ program that prompts the user to enter a character. If the character is a
vowel (a, e, i, o, u), display "Vowel". Otherwise, display "Consonant"
Question#4 (5 marks)
(if-else) In a particular country, the legal age for voting is 18 and for driving is 21. Check if a person is
eligible for voting, driving, both, or none based on their age.
Sample:
90-100: A+
85-89: A
80-84: A-
75-79: B+
70-74: B
65-69: B-
60-64: C+
55-59: C
50-54: C-
Below 50: Fail