You are on page 1of 8

CSE 215L: Programming Language

II Lab
Faculty: Silvia Ahmed,
Sec – 9, 10
Lab 3 – Spring 2021
Task 01
• Use a loop to take inputs until user enters 0.
• Inside the loop statement, use if-else to check positive or
negative and declare two different variables to count them
respectively.
• Use one more variable to calculate the sum.
• After the loop, divide the sum by total number of inputs.
Task 02
• Here 10000 + 10000*1*(5/100) = 10500 and then again 10500
+ 10500 *1*(5/100) so use result to calculate the new tuition
fee for ten years.
• Then use the same formula in a loop that runs four times and
inside the loop each time you calculate the fee, add the fee to a
sum.
Task 03 and Task 04
• Use % operator to find factors and divide the number by
factors inside the loop.
• You can try them yourself.
Task 05 and Task 06
• See for java pattern printing.
• See this videos:
1. https://www.youtube.com/watch?v=LLDIiIyU1Pc&list=PLg
H5QX0i9K3oAZUB2QXR-dZac0c9HNyRa&index=49
2. https://www.youtube.com/watch?v=2Rquz1rstM4&list=PLg
H5QX0i9K3oAZUB2QXR-dZac0c9HNyRa&index=50
Task 07
• Prompt the user.
• Assigning the numbers to the weekdays is same as the task 03
of the lab manual 2.
• Add the number of days in the month (i.e. if user entered a
leap year, then you should add 29 for February) to the day.
• Then mod the sum by 7. and the result is the day of the first
day of the next month.
Task 08
• Follow the instructions in the question.
Task 09
• This is an extra task.
• If you feel interested you can try it yourself.

You might also like