Array and Strings – Algebra – Problem #2
IIT Kharagpur CS10001 / CS11001 Programming and Data Structures Lab Question Archive
Problem Statement
Generate a database of three 4-digit account numbers and corresponding available balances (less than 1000 INR) using 1D-Arrays. Later a user should be able to withdraw money from their account. The program should take the account number and withdrawal amount as input and check whether that is a valid account number and if the withdrawal amount is less than the available balance. If that is the case, then a transaction should take place and the program should update the available balance in the account. In case of failure the program should output appropriate error messages like Invalid Account, Insufficient Balance. Sample Output: Here is one sample output: Database: Account Number of User 1: 1 2 3 4 Available Balance: 150 Account Number of User 2: 3 4 3 2 Available Balance: 78 Account Number of User 3: 5 6 3 2 Available Balance: 7800 Transaction Time: Please enter your Account Number: 3 4 3 2 Withdraw amount: 10 Transaction successful. Do you want to see your updated balance? [enter 1 for yes and 0 for no]: 1 Available Balance updated: Account Number: 3 4 3 2 Available Balance: 68