Question
Use java RMI to program a simple remote bank account for a customer John Raymond. The account object should exist remotely and the client should
Use java RMI to program a simple remote bank account for a customer John Raymond. The account object should exist remotely and the client should use Java RMI to lookup the remote account object and perform operations on it.
---Internal Use--- The remote bank account should be implemented in a class named AccountImpl. It should store two attributes name and balance. Attribute balance should of type Money, a simple serializable wrapper around a double. Class AccountImpl should have get/set methods for name and balance, it should also be able to have the following two functions to operate on balance: withdraw and deposit. Your code for creating an AccountImpl object and registering it with rmiregistry should be in class RemoteAccount. The client should have the code to lookup the remote object from rmiregistry and use that object to deposit/withdraw money to the account. You are free to use any other additional classes/methods needed to complete the requirements for deposit, withdrawal and display current balance remotely in the client. Java code package structure: You should create three directories : bank, common, and client. Code for the remote server classes should be in bank. Code for the common interfaces should be in common Code for client should be in client. Open two terminals. In terminal one, start the rmiregistry in the background and then start the service for the remote account as : java bank.RemoteAccount. Assuming your client is defined in class AccountClient, In the other terminal, you should run the client java client.AccountClient to perform the operations of deposit and withdrawal. It should print simple messages in the terminal showing the effect of the operations. You can use the following machines for RMI : in-csci-rrpc01.cs.iupui.edu in-csci-rrpc02.cs.iupui.edu in-csci-rrpc03.cs.iupui.edu in-csci-rrpc04.cs.iupui.edu in-csci-rrpc05.cs.iupui.edu in-csci-rrpc06.cs.iupui.edu You are free to run your server bank.RemoteAccount and client client.AccountClient in any of the machines above. For example: You are running the server in in-csci-rrpc01 and client in in-csci-rrpc02.. Your code in bank.RemoteAccount should have the correct machine name (in-csci-rrpc01) to bind your remote object. Similarly your code in client.AccountClient should have the correct machine name (in-csci-rrpc01) to lookup the remote server object. Also, before running rmiregistry, make sure no older instance of rmiregistry is running in your account, if it is running, you may have to kill it before starting the new rmiregistry. Please Note: This is a graduate level class. If you face compilation problems or exceptions while running
Step 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