Week 2 Exercises
Week 2 Exercises
Exercise 1
1. Write a program which reads two integer values. If the first number is less than the
second, print the message "First number is less than the second".
If the second is less than the first, print the message "Second number is less than the
first".
If the numbers are equal, print the message "The numbers are equal".
2. Write a program that prompts the user to enter age. If age of the user is equal to or
greater than 18, then the proram displays “You are eligibel to vote”. Otherwise the
program displays “You cannot vote”.
3. The Young and Beautiful Travel Company restricts its clients to ages between 18 and 30.
Write a program to input a client's age and test whether they are eligible to go on
vacation with the company or not.
4. Write a program to input a salary from the user and determine how much tax
someone should pay according to the following rules:
People pay no tax if they earn up to €10,000. They pay tax at the rate of 20% on the
amount they earn over €10,000 but up to €50,000. They pay tax at 40% on any money
they earn over €50,000.
6. Write a program which displays a menu to the user. The menu should look similar to the
following:
Read in the selection from the user and then ask the user for two numbers.