Lab 04
Lab 04
NOTE: for all the task where validation is required use loop to validate value and
program will ask for new value whenever a wrong input is given
int x=1;
while ( x <= 10 ){
cout<<x<<endl;
x++;
}
}
Task-03 (Denomination)
Change the Lab-task-05 of Lab-02 to find denomination in given amount. Use the same
scenario and implement the task using while loop.
1
Task-05 (Ocean Level)
Assuming the oceans level is currently rising at about 1.5 millimeters per year, write a
program that display a table showing number of millimeters that the ocean will have
risen each year for the next 25 years. Assuming the starting year is 2018.
Task-08 (Population)
Write a program that predicts the size of a population of organisms. The program should
ask the user for the starting number of organism, their average daily population increase
(as percentage), and the number of days they will multiply. A loop should display the size
of population for each day.
Input Validation : Do not accept a number less than 2 for the starting size of population.
Do not accept a negative number for average daily population increase. Do not accept a
number less than 1 for the number of days they will multiply.
2
Task-11 (Hotel Occupancy)
Write a program that calculates the occupancy rate for a hotel. The program should start
by asking the user how many floors the hotel has. A loop should then iterate one for each
floor. In each iteration, the loop should ask the user for the number of rooms on the floor
and how many of them are occupied. After all the iterations, the program should display
how many rooms the hotel has and the percentage of rooms that are occupied.
Input validation: the program should not accept the number less than 1 for the number of
floors and do not accept a number less than 10 for number of rooms on each floor.
Task-12 (Palindrome)
Modify task-11 of lab 3 so it may accept integer of any length to determine whether its
palindrome or not.
If a negative balance is calculated at any point, a message should display indicating that
account has been closed and loop should terminate.
Submission Instructions
Store File as Lab-04-Task-01.cpp (Task Number will change with each task)
Write Observation File for your lab task and store as readme.docx
All .cpp files and .docx file must be compresses as YOUR_ROLL_NUMBER-Lab-
04.zip
Only submit one zip file