0% found this document useful (0 votes)
6 views

conditional statement

O level computer P2 ch7 notes

Uploaded by

abdullahkiing789
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

conditional statement

O level computer P2 ch7 notes

Uploaded by

abdullahkiing789
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

Eligibility Checker for University Admission:


A university requires students to meet the following criteria to be eligible for admission:

o Marks in Math ≥ 80 AND Marks in Physics ≥ 70

o OR if the total marks in Math and Physics are greater than 160
Write a pseudocode to determine whether a student is eligible for admission or not.

2. Temperature Warning System:


Write a pseudocode to determine the status of a machine based on the temperature input:

o If the temperature is below 0°C, output "Too cold, turn off the machine."

o If the temperature is between 0°C and 50°C, output "Machine is operating normally."

o Otherwise, if the temperature is above 50°C, output "Overheating! Shut down


immediately."

3. Tax Calculation:
Write a pseudocode to calculate the tax a person has to pay based on their income:

o If income is less than $10,000, tax is 5% of the income.

o If income is between $10,000 and $50,000, tax is 15% of the income.

o If income is greater than $50,000, tax is calculated as follows:

 First $50,000 is taxed at 15%.

 Remaining amount is taxed at 25%.


Output the total tax.

4. Electricity Bill Calculation:


Write a pseudocode to calculate an electricity bill based on the units consumed:

o For the first 100 units, the cost is $0.5 per unit.

o For the next 200 units, the cost is $0.75 per unit.

o For consumption beyond 300 units, the cost is $1.20 per unit.
Calculate and output the total bill.

5. Library System Late Fees:


Write a pseudocode for a library system that calculates the fine for late book returns:

o 1–5 days late: $2 per day.

o 6–10 days late: $5 per day.

o 11–30 days late: $10 per day.

o More than 30 days late: Output "Membership canceled."


Use a CASE OF...OTHERWISE statement to handle this.

6. Grade-Based Scholarship System:


A scholarship system assigns scholarships based on grades:

o Grade A: $5000
o Grade B: $3000

o Grade C: $1000

o Otherwise: "No scholarship awarded."


Write a pseudocode for the system using CASE OF...OTHERWISE.

7. Traffic Signal Simulator:


Write a pseudocode to simulate a traffic signal based on user input:

o 1: Red - "Stop"

o 2: Yellow - "Prepare to stop"

o 3: Green - "Go"

o Otherwise: "Invalid input."

Mixed Challenge

8. Restaurant Menu System:


A restaurant offers the following items:

o Main Course:

 1: Pasta ($10)

 2: Pizza ($12)

 3: Burger ($8)

o Desserts:

 1: Ice Cream ($5)

 2: Cake ($6)
Use nested IF or CASE OF...OTHERWISE to write a pseudocode that asks the
user to select a category (Main Course or Dessert), then choose an item, and
finally calculate the total price.

You might also like