Problem Solving
This assignment is designed to help students practice
problem-solving with selective structures (also known as
decision-making or conditional statements). The assignment
encourages them to use conditional logic to solve real-world
problems in programming.
Instructions:
1. For each problem below, write an algorithm that uses selective structures to arrive at the
correct solution.
[Link] each solution with various inputs to ensure accuracy
[Link] mention what u think is the required input and output of each problem.
Problem : Grading System
Create a program that takes a student's score as input and prints their grade based on the
following scale:
- A: 90-100
- B: 80-89
- C: 70-79
- D: 60-69
- F: Below 60
Problem: Temperature Converter with Warnings
Write a program that converts temperature from Celsius to Fahrenheit. Additionally, display a
warning if the temperature in Celsius is below 0 (freezing point) or above 35 (high
temperature).
Problem : Simple ATM Machine
Create a simple ATM program that lets the user perform one of the following operations:
- Check Balance
- Deposit
- Withdraw
If the user selects "Withdraw," ensure they have enough balance. Use a switch or if-else
structure to implement this.
Problem: Leap Year Checker
Create a program that determines if a given year is a leap year. A leap year is:
- Divisible by 4.
- Not a leap year if divisible by 100 unless it is also divisible by 400.
Problem: Password Strength Checker
Create a program that checks the strength of a password based on the following conditions:
- Strong: Password length is 8 or more, includes uppercase and lowercase letters,
numbers, and special characters.
- Medium: Password length is 6 or more, includes letters and numbers.
- Weak: Password is less than 6 characters or contains only letters.
Problem: Login Authentication with Two Conditions
Write a program that allows a user to log in only if they provide the correct username **and**
password. If either is incorrect, deny access.