Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this project, youre going to create a client-server connection using Java code that weve practiced in the Activities this semester. This program is a

For this project, youre going to create a client-server connection using Java code that weve practiced in the Activities this semester. This program is a very simple server-based program that has many uses in the modern age, such as online banking, online gaming, school registries, and many more. For this project, were going to create an application for online banking.

For this program, the first thing you should do is setup the Server and have the Client connect to it. From there, the Server and Client should both maintain the connection until the user is finished. Once connected, the Client should display 4 options to the user and allow him/her to select between them (you may do this in any way you choose, but you must have data validation for any possible invalid entries). The four options are as follows:

Display Account Funds Get the amount of money in the users account from the Server and display it to the user on the Client-side.

Deposit Funds Ask the user how much money they would like to deposit (for the sake of this activity, assume the user has unlimited funds) and send the amount chosen to the Server to add to the funds in the users account.

Withdraw Funds Ask the user how much money they would like to withdraw and remove the amount chosen from the users account. The withdraw amount must be equal to or less than the amount in the users account; if the user asks to withdraw more money than they have in their account, an error message should display to the user, the withdraw should be cancelled, and the user should be taken back to the menu.

Exit and Logoff This option should simply close the connection between the Server and Client, close all I/O, and terminate both programs.

The Server should set up the users initial account, giving them a $0.00 balance when they first log on. Then the Server should enter into a loop in which each iteration consists of waiting for a response from the Client for which option the user chose (since all 4 options will require the Server to do something) and acting accordingly. When the operation is complete, the loop should restart and repeat the process until the user chooses to exit.

Project Guidelines

There are a few guidelines that you must follow for this program. When you have finished creating the program, make sure to check back over these guidelines to check that everything has been accounted for.

The guidelines are as follows:

The program must be a console-based application. No GUIs allowed.

The program must loop through the options until the user selects to exit.

You may get user input any way you choose however, you must catch all invalid entries. This means that if your options are 1-4, then a user entry F should be caught and give an invalid entry feedback, then allow the user to reenter their choice. Valid entries must also be checked when asking for monetary amounts positive integers, doubles, or floats. No negative numbers should be valid.

User-friendliness is important! Make sure that your program looks nice and easy to use.

Send regular messages to the servers console. This helps when writing the program to know exactly where the Servers execution is during RunTime and can also help find and fix bugs in the code.

Make sure that in the natural runtime of your program when the server is disconnected that all sockets, scanners, and any other form of I/O is closed leaving these open can cause a security leak that, while harmless on a localhost, can be dangerous on other IPs.

Leave documentation and comments in your code to explain things step-by-step. This is just good practice. It doesnt have to be a lot; just enough to explain your process in a simple way.

Code written must be your own. You are not allowed to copy code from any source, including but not limited to other students, textbooks, websites, etc.

Sample Execution

This is a sample run of the program youre expected to write. Feel free to use this sample to answer execution questions you may have, or use it as a foundation for how your program should look. Keep in mind that this isnt necessarily the only way to write this program; your code may perform slightly differently and your messages and output may also be different.

To begin, we start the program by running the Server and then running the Client. The Client connects to the Server and we get the following console:

Connecting to Server...

Connection Successful.

Welcome to the ITCS-3166 Student Bank.

What would you like to do today?

1) Check Balance

2) Deposit Funds

3) Withdraw Funds

4) Exit

>2

Since our account starts with a zero balance, well first need to deposit some money. First we hit the wrong key while typing the amount we want to deposit, then we improve our typing skills and type the correct amount.

How much do you want to deposit?

>25t0.00

The amount you have entered is invalid.

What would you like to do today?

1) Check Balance

2) Deposit Funds

3) Withdraw Funds

4) Exit

>2

How much do you want to deposit?

>250

$250.00 has been deposited into your account.

What would you like to do today?

1) Check Balance

2) Deposit Funds

3) Withdraw Funds

4) Exit

>3

At this point, our friend tells us that Toppers Pizza is having a sale of 100 Pizzas for $500. So were going to need to take out some money to be able to buy lots of pizza. Unfortunately, our stomach is bigger than our wallet, and the bank is quick to let us know.

How much do you want to withdraw?

>500.00

Your account does not have the requested amount of funds.

Then we remember that we only put $250 in our account, so we decide to take that instead and hope that our friend will split the cost of the pizzas.

How much do you want to withdraw?

>250.00

$250.00 has been withdrawn from your account.

Finally, we ensure that we have no money left in our account and accept our life choices.

What would you like to do today?

1) Check Balance

2) Deposit Funds

3) Withdraw Funds

4) Exit

>1

Your account balance is: $0.00

What would you like to do today?

1) Check Balance

2) Deposit Funds

3) Withdraw Funds

4) Exit

>4

So we exit out of the online banking system and go enjoy endless amounts of pizza.

>4

Thank you for using the ITCS-3166 Student Bank!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro PowerShell For Database Developers

Authors: Bryan P Cafferky

1st Edition

1484205413, 9781484205419

More Books

Students also viewed these Databases questions