Lab Excercises
Upload to Unikl VLE
Solution : Github
Due date: Friday, 2nd September 2022
1. Switch Case Excercise
Write a program using a case statement that determines the grade point of a subject according to the grade entered.
A :4.0
B :2.7
C :2.0
D :1.0
E :0
Display the corresponding grade point on screen together with the grade.
2. If Excercise
Write a program using If..else
statement that will determine the economic category of people according to their Monthly salary
Accept the name, age and salary as input. Then determine the category of their income as per table below:
x == Monthly Salary
Salary | Category |
---|---|
x < 4000 | B40 |
4000 < x <10,000 | M40 |
x > 10,000 | T20 |
3. Loop Excercise
bliss Cafe is a small cafe that runs its business from 10 am to 10 pm daily. Every hour the cashier is required to update the total sales of the hour to keep track of the cafe’s performance.
Write a program that will automatically calculate the sum of sales figure entered by the user to tally up the daily sales of bliss cafe.
Use loop / iteration to help you in this problem.
4. Sequence Excercise
Write a program That accept name, year of birth as input. Calculate the age of the person according to the year entered.