Part 1: Application

Use the inheritance hierarchy shown for GeometricObject (in Lab 01, Q4 page 3) and add two classes to represent Equilateral Triangle and Cylinder respectively. Design and create these two additional classes - EquilateralTraingle and Cylinder. Your objective is to reuse as much code as possible.

Design a complete UML diagram for the given case, then design and implement the above requirements.

Part 2: GUI application

Design an appropriate GUI application to set up and run the proposed Geometric Shape that would allow a user to create any Geometric Objects and read a text file containing Geometric object details and print its area and perimeter. You may use the sample design as given in the Lab 02 Question 5.

The GUI for this assignment should create at least two new classes one being the JFrame for displaying the GUI JPanel , and the GUI JPanel with its components.

The GUI needs to be able to allow

  • Calculation of area and perimeter of different Geometric Objects based on a user selection. User should be able to select different Geometric Object and based on the Object type, user is asked to input radius, width, length or sides etc. Then the GUI application calculates and display area and perimeter.
  • Reading of Geometric Object information from a file as GeometricOjects.tx t and printing out a report of all Geometric Objects information with area and perimeter.

    Your GUI application should also contain a button to read a file GeometricObjects.txt. The program should read each line, calculate area and perimeter of the object and display the information in TextArea. Your program must work for any data file in this format as given below, regardless of how many entries.

Format of the data file should be as the following:

Object Type, Data

Example

Circle, 6.0
Rectangle, 3.5, 4.5
Triangle, 2.3, 3,4, 4,2

Part 3: Server and client versions

For this part of the assignment you may assume that the Geometric Shape Constructor Application is running on the server. The server calculates area and perimeter of the object sent from the client.

The system is sending and receiving data using the User Datagram Protocol (UDP). A client sends an objects related information Object type and its attributes example radius/width/length to the server. The server will validate the message received from the client, that, it calculates area and perimeter of the Geometric Object. The server then sends back the message to the client. The server's port number for this assignment is 20171.

The server, may or may not implement the GUI. The server program must continue to listen to the client. There is no need of reading or saving data files.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.