0% found this document useful (0 votes)
7 views2 pages

Programming Decisions and Conditions Guide

The document outlines a tutorial for programming tasks focused on selections and decision-making. It includes 11 exercises that require writing programs to handle various scenarios such as voting eligibility, temperature checks, loan qualifications, discounts, student assessments, BMI calculations, bank withdrawals, school trip permissions, and leap year verification. Each task emphasizes the use of conditional statements to determine outcomes based on user input.

Uploaded by

choongocliff5
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

Programming Decisions and Conditions Guide

The document outlines a tutorial for programming tasks focused on selections and decision-making. It includes 11 exercises that require writing programs to handle various scenarios such as voting eligibility, temperature checks, loan qualifications, discounts, student assessments, BMI calculations, bank withdrawals, school trip permissions, and leap year verification. Each task emphasizes the use of conditional statements to determine outcomes based on user input.

Uploaded by

choongocliff5
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

ANALYSIS AND DESIGN TUTORIAL 2: SELCTIONS AND DECISION MAKING

1. Write a program that will receive a person’s age as an input, checks if the
person is eligible to vote. (Voting age is 18 or older).

2. Write a program that receives the temperature as an input and displays ‘Hot’ if
the temperature is greater than 30, otherwise display ‘Cool’

3. Write a program that will asks the user to enter a number between 1 and 7
and display a day of the week depending on the entered number. If the
number is 1, output "Sunday", else if it is 7, output "Saturday" else output
‘Working day’.

4. A person can be eligible for a loan if their income is greater than 5000 OR
they have a credit score higher than 700. Write a program that receives the
income and credit score as input and check if the person qualifies for a loan
and if they do, display ‘Eligible’ else display ‘Ineligible’.

5. You’re tasked with writing a program that will check if a customer qualifies for
a discount after ordering a meal at a restaurant. The program will receive the
bill amount as an input. If the bill amount is greater than 100, the program
should do the following:
- calculate and display a discount amount which is 10% of the bill amount.
- If the discount amount is greater than 20, Recalculate the discount amount
by dividing it by 2, else Recalculate the discount amount by subtracting 5
from it.
- Recalculate the bill amount by subtracting the discount amount from it.
Display the bill amount at the end of the program.
6. You have been tasked to write a program that informs a student if they passed.
The student will provide their marks as an input. Your program should check if
the score is greater than or equal to 50 and display ‘Passed’ if its.

7. Write a program that will receive the users age as input and check for the
following: If the age is below 13, display "Child", else display "Adult".

8. Write a program that will be used to display the body mass index (BMI) of a
user. The user will be asked to provide their weight and height. The program
will then calculate the BMI as: weight divided by the square of the height. If the
BMI is less than 18.5 then display ‘Underweight’ else if the BMI is greater than
25.0 then display ‘Overweight’, else display ‘Normal Weight’.

9. Write a program that will display whether an individual is allowed to withdraw


from their bank account. The program should receive the account balance and
the withdraw amount as inputs. A person is eligible to withdraw money if their
account balance is greater than or equal to the withdrawal amount. If they are
eligible check if the withdrawal amount is not greater than the withdrawal limit
of 2500. Display ‘Eligible’ if all the conditions are met else display ‘Ineligible’.

10. Write a program that will inform a student if they can go on a school trip with or
without consent. Students that are between 22 and 25 years of age, and are in
fourth year or higher are allowed to travel without consent. While students
between 19 and 21 of age and are below fourth year, will need consent. Your
program should display ‘No Consent Needed’ or ‘Consent Needed’, depending
on the above stated conditions.

11. Write a program that checks if a year that is provided by the user is a leap year
and output ‘Leap year’ if it is, else output ‘Regular year’. The condition for a leap
year is that is divisible by 4 but not 100 OR it is divisible by 400.

You might also like