Question
n the case of a deposit, the server should increment the bank accounts balance field by the deposit amount and then return a message to
n the case of a deposit, the server should increment the bank accounts balance field by the deposit amount and then return a message to the client stating the new balance. In the case of a withdrawal, assuming sufficient funds exist, the server should decrement the bank accounts balance field by the withdrawal amount and then return a message to the client stating the new balance. If sufficient funds do not exist to cover the withdrawal amount, then the server should return a message to the client indicating this. In the case of Balance, the server should simply respond to the client with the balance of the account. In all cases, the socket should be closed immediately after the transaction is complete.
Can someone help? I'm new to this. Thanks
Directions: The following programming assignment should be completed in Cor C++ using the standard socket libraries that come with your operating system. It is highly recommended that you complete this assignment in Unix/Linux as this is what will be utilized in the solutions (and is also what is used in the textbook). If you are using a Windows machine, then I highly recommend installing Cygwin, which is a utility that allows you to run Linux on top of Windows not the fasting thing in the world, but it will get the job done 1.Write a server application that represents an online banking utility. Let your server maintain an array of"bank accounts," which will be objects of the following struct type struct bank account int acct num char password[8] max password length is 8 characters double balance You should create a set of 3 or 4 test accounts with made-up values to populate this array Your application should use a server socket to listen in to incoming client connections. As soon as a client ogs on, it should present the client with the following prompt Welcome to [Choose A Namel Bank: Please enter an account number: After an account number is received from the client through the socket connection, the server program should check ifthe corresponding bank account exists. If not, return an error message to the client and close the connection. If the account does exist, then present the client with the following prompt Please enter password The server program should then wait until the client responds with a password. Once this occurs, the servershould validate the password. Ifthe password is incorrect, return an error to the client and close the connection. If the password is correct, then present the client with the following prompt: Please enter a transaction: The server program should then expect a command o on the following forms This deposits $123.45 into the selected account Deposit 123.45 This withdraws $98.76 from the account (if the amount is available) Withdraw 98.76 This displays the balance BalanceStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started