0
binler acilen c dili bilen panpa lazım. bi ödev var dönem sonu notunu etkiliyo. lütfen yardım edin çıkamadım işin içinden
soru
Atılım University
Computer Engineering Department
COMPE 112
Computer Programming in C
Homework 1
Due Date: April 14, 2011 (Thursday)
Write a C program for creating Bank account transactions. The program shall provide the following functionalities:
• Initialize Account: Write a function which prompts the user for the type of account. You are given the following account types:
o Checking Account (Vadeli Hesap)
o Deposit Account (Vadesiz Hesap)
Note that the initial balance amount is 0.0.
Function Prototype: char init_account(void);
• Deposit money: Write a function that deposits money into current bank account. The function takes the money as a functional argument, adjusts the balance of the current user and return the new balance.
Function Prototype: double deposit_money(double money);
• Withdraw money: Write a function that withdraws money from the account. The function takes the amount of money to withdraw as an argument, adjusts the balance and return the new balance. It is important to note that the requested amount to withdraw must exist in the current balance. If there is not enough money in the account, the program displays a warning message such as “Sorry, Not enough money in your balance”.
Function Prototype: double withdraw(double money);
• Credit money: Write a function that performs credit money in the account. The function takes the number of months as a functional argument, adjust the balance using bank simple interest rates and return the adjusted balance. Assume that the Bank offers 15% simple interest for each month. The adjusted balance is calculates as follows:
B = B + r*B*m
Where r is the interest rate, B is the balance and m is the number of months elapsed.
Function Prototype: double credit(int month);
The program shall provide a Bank Account Transactions menu as follows:
•
**
•
** BANK ACCOUNT MANAGEMENT SYSTEM***
1: Create Account
2: Deposit money
3: Withdraw money
4: Credit money
5: Display amount
6: Quit
The program prompts the user for the choice of operation. According to the user choice, the program performs the operations. The sample run including each operation is given below.
panpalar soru uzun değil. burdan sonrası programın örnek olarak çalıştırılmış hali. soru yukarda
Sample Run:
•
**
•
** BANK ACCOUNT MANAGEMENT SYSTEM***
1: Create Account
2: Deposit money
3: Withdraw money
4: Credit money
5: Display amount
6: Quit
Enter your choice: 1
There are two types of bank accounts:
Checking Account (C)
Deposit Account (D)
Enter the type of account you want (C/D): C
•
**
•
** BANK ACCOUNT MANAGEMENT SYSTEM***
1: Create Account
2: Deposit money
3: Withdraw money
4: Credit money
5: Display amount
6: Quit
Enter your choice: 2
Enter amount of money: 500
Account Type: Checking Account
Current Balance: 500.00
•
**
•
** BANK ACCOUNT MANAGEMENT SYSTEM***
1: Create Account
2: Deposit money
3: Withdraw money
4: Credit money
5: Display amount
6: Quit
Enter your choice: 3
Enter the amount to withdraw: 2000
Account Type: Checking Account
Current Balance: 500.00
Sorry, Not enough money in your balance!
•
**
•
** BANK ACCOUNT MANAGEMENT SYSTEM***
1: Create Account
2: Deposit money
3: Withdraw money
4: Credit money
5: Display amount
6: Quit
Enter your choice: 3
Enter the amount to withdraw: 200
Account Type: Checking Account
Current Balance: 500.00
Are you sure to withdraw 200 TL ?(y/n): Y
Current Balance : 300.00
•
**
•
** BANK ACCOUNT MANAGEMENT SYSTEM***
1: Create Account
2: Deposit money
3: Withdraw money
4: Credit money
5: Display amount
6: Quit
Enter your choice: 4
Enter number of months: 5
Account Type: Checking Account
Current Balance: 300.00
Your new balance: 525
•
**
•
** BANK ACCOUNT MANAGEMENT SYSTEM***
1: Create Account
2: Deposit money
3: Withdraw money
4: Credit money
5: Display amount
6: Quit
Enter your choice: 6
Are you sure to quit (y/n)? Y
Have a nice day…
Tümünü Göster