Multithreading and networking, JAVA Programming

Assignment Help:

This assignment has two main objectives. It aims to establish a basic familiarity with the Java API (Java Thread class) for creating multithreaded Java application, and the Java networking packages for creating a client-server Java application.

1. Objectives

 Apply Java multithreading concepts
 Make use of Java API "Net" package
 Make use of Java API "Swing" and "AWT" packages
 Handle generated events
 Comprises classes designed based on object-oriented concepts
 Makes use of Java programming fundamentals

2. Scope

You are required to build a calculator based on the client-server architecture. This means that for your calculator application, the GUI should be run as a client, and all calculations should be carried out by a server. Your server should be able to serve multiple clients concurrently, meaning that it should be a threaded server. Besides providing the required functionalities, your program should incorporate appropriate error handling. Comments are also to be inserted to improve program clarity.

3. Requirements

Your program must satisfy all the requirements as described in this section. Take note that all required input / output are carried out through a graphical user interface. Make use of what you have learnt pertaining to multithreading, networking, Java GUI and event handling concepts to design and build this application.

(a) Calculator Server

The server side of your application should perform calculations and serve multiple clients concurrently. As such, the following requirements must be satisfied at the server end:

1. The server should accept input, meaning numbers and operations required, from the client. After computation is completed, the output should be sent back to the client for display.

2. The server should serve multiple clients concurrently. The server should therefore be designed as a threaded server.

3. All possible exceptions (especially pertaining to TCP/IP networking) should be handled, with error messages being generated if exceptions are encountered.

(b) Calculator Client

The client side of your application should have two interfaces. The first interface allows a user to enter the hostname and port number so that the client can make a connection with the server first. If non-numerical characters are entered in the port number field, the user should be alerted and be given another chance to re-enter. If a connection cannot be made due to incorrect hostname/port number entered or server not started, the user should be alerted too and be given another chance to re-enter.

2253_calculator.png


Once a successful connection is made with the server, the main calculator interface will then be shown. The following requirements must be satisfied:

2022_calcyy.png

1. Your application must be able to execute simple operations (+, -, *, /, =) on both real numbers and integers.

2. When a number is divided by 0, "Error" must be displayed.

3. '=' button acts as a termination, as well as reset, button. This means that after you have pressed in '4', '-', '3', and then '=', the result '1' will be displayed. The next number button that you press will be the first number of your next string of operation.

4. 'C' is a reset button so if you decide to abort, you just have to press 'C' button and '0' will appear. After this, the next number button that you press will be the first number of your next string of operation.

5. 'Sqrt' will give the square root of a number. For example, when you pressed in '4' and then 'Sqrt', '2' will be shown in the display. However, when you pressed in '-', '2' and then 'Sqrt', "Error" will be displayed.

6. If you pressed a number button (say '2'), 'Pwr' button, a second number button (say '3') and then the '=' button, the result shown on the display will be 2 to the power of 3, which is 2*2*2 or '8'. If you press '-', '2', 'Pwr' and then '3', the result shown will be '-8'. If you press '1', 'Pwr' and then '0', the result shown will be '1'. If you press '0', 'Pwr' and then '1', the result shown will be '0'. If you press '0', 'Pwr' and then '0', "Error" will be shown.

7. The only way to display the input on the calculator display is by pressing the buttons.

8. Remember that ALL calculations must be performed by the server.

(c) Program Termination

Should a user decide to terminate the program, the 'Quit' button should be pressed. The connection with the server must be terminated properly before the program ends.

(d) Error Handling

Your program should be able to handle errors and exceptions. You should look out for other possible exceptions and handle them too.

(e) Execution Instructions

Please write clearly, on your report, the step-by-step instructions on running your application. It is important that you include the port number, server and client Java program name, and any other essential information required to run your application successfully.


Related Discussions:- Multithreading and networking

I clicker, i am to find 75% of i clicker score.Each correct answer is worth...

i am to find 75% of i clicker score.Each correct answer is worth 2points and an incorrect 1point. Express grade as a percentage (i.e the max is 100%). e.g 1 no i clicker question

Program to create 5 objects and get them interact together, In this assignm...

In this assignment, you will create 5 objects and get them to interact together. You will create theatres for which patrons will buy tickets from a box office to watch movies.

Develop a java application, Modules of software: 1 - Serial RS232 comm p...

Modules of software: 1 - Serial RS232 comm port comunication 2 - NanoHTTPD serving some processed pages 3 - System tray application to indicate status and access configura

List down the analytical engine''s elements name, List down the Analytical ...

List down the Analytical Engine's elements name An analytical engine elements are as follows: Input Memory Processor Output.

What is dispatchaction, The DispatchAction class is used to group related a...

The DispatchAction class is used to group related actions into single class. Using this class, you can have a method for every logical action compared than a one executes method. T

Task priority and uses in scheduling, What do you mean by a task's priorit...

What do you mean by a task's priority and how can we use it in scheduling ?

Relation between stack and heap, Relation between Stack and Heap Stack ...

Relation between Stack and Heap Stack and heap are two significant memory areas. Primitives are created on the stack whereas objects are created on heap. This will be further c

What is overriding, What is Overriding? When a class explains a method ...

What is Overriding? When a class explains a method using the similar name, return type, and arguments as a method in its superclass, the method in the class overrides the metho

What does it mean that a method or class is abstract, What does it mean tha...

What does it mean that a method or class is abstract? An abstract class cannot be instantiated. Abstract methods may only be included in abstract classes. However, an abstract

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd