Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

SCHOOL OF GENERAL AND FOUNDATION STUDIES

AIMST UNIVERSITY
BI034/SI034 INFORMATION TECHNOLOGY STUDIES 3
LAB EXERCISE 4: If..Else Statement

Exercise 1: Calculate Electric Bill


Write a program that takes electric units as input from the user. There are unit rates assigned by the
programmer and the program calculates the electricity bill based on the unit rates given as follows: -
For first 50 units RM 0.50/unit
For next 100 units RM 0.75/unit
For next 100 units RM 1.20/unit
For unit above 250 RM 1.50/unit
An additional surcharge of 20% is to be added to the bill

Exercise 2: Calculate attendance, display eligibility for examination.


A student will not be allowed to sit in exam if his/her attendance is less than 75%.
Write a program for the following task :-
Take following input from user :
Number of classes held
Number of classes attended.
Calculate and print :
Percentage of class attended
Is student is allowed to sit in exam or not.

Exercise 3: Upper case or Lower case Character


Write a program that allows user to enter a character, then it checks and displays whether the given
character is an upper case or lower case character.

Exercise 4: Write a program ask the user to input a character and then check whether the character
is an alphabet or not.

Exercise 5: Determine time


Write a program to ask user to enter time in 24 hour system and show that whether it is AM or PM.

Exercise 6: Write a C++ program to ask the user to enter a year and then check whether a year is a
leap year or not.

Exercise 7: Write a C++ program to ask the user to enter input a number between 1-7 and print the
name of the day in the week. Monday being 1, and Sunday being 7

You might also like