Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Q1)) ATM Services

Write a C code for an ATM machine.

First ask the user to enter the PIN, then the ATM should show a welcome message and different choices,
as the following:

“Welcome to XYZ Bank Services, please enter your choice:”

Enter 1 for cash withdrawals.

Enter 2 for Balance Inquiry.

Enter 3 for Fund Transfer.

• If the user chooses 1, there are several options to specify the amount of cash the user want to
withdraw:
1. Fixed amount options: the amount entered should be in multiples of 5, if not, a message
should inform the user that the amount entered is not correct. If the amount entered is
correct, it shouldn’t exceed the balance limits. If so, print the amount. Otherwise, a message
should inform the user to try again!
2. Custom amount: if the user chooses this option, check if the amount is within the limits of
the balance, and if so, print the amount. Otherwise, print a message that the amount
exceeds the balance.
• If the user chooses 2, print the available balance in the user account.
• If the user chooses 3, ask the user for the amount he wants to transfer, then let him enter the
amount. And check if the amount to be transferred is within the balance limits.

Sample 1:
Sample 2:

Sample 3:
Q2)) Employee portal- Vacation System
Ahmed is an employee at ABC company. He wants to take a vacation and submit it through the employee
portal. Write a C code for the system to perform the following:

• If the vacation is in the first quarter of the year and the vacation days are less than 4 days, he can
take the vacation. Otherwise, there will be a deduction on his salary equal to 5%.
• If the vacation is in the second quarter of the year and the vacation days are less than 11 days,
he can take the vacation. Otherwise, there will be a deduction on his salary of equal to 3%.
• If the vacation is in the third quarter of the year and the vacation days are less than 12 days, he
can take the vacation. Otherwise, there will be a deduction on his salary of equal to 3%.
• If the vacation is in the third quarter of the year and the vacation days are less than 4 days, he
can take the vacation. Otherwise, there will be a deduction on his salary of equal to 0%.

Note :

Months 1,2 and 3 are in the first quarter.

Months 4,5 and 6 are in the second quarter.

Months 7,8 and 9 are in the third quarter.

Months 10,11 and 12 are in the fourth quarter.

Output sample:

You might also like