Question: Prgram in Java. home / study / engineering / computer science / questions and answers / Use Pen/paper Or A Design Tool Such As Visio

Prgram in Java.

home / study / engineering / computer science / questions and answers / Use Pen/paper Or A Design Tool Such As Visio To ...

Your question has been answered

Let us know if you got a helpful answer. Rate this answer

Question: Use pen/paper or a design tool such as Visio to de...

Use pen/paper or a design tool such as Visio to design the application described below. After you design, go ahead and implement it. Your submission should include the entire project (zip the entire project and submit), and the design document (as a PDF file. If you want to put some explanation, you can get a screenshot and paste it as an image into a Word document, then Save As PDF). The design document should be the fully defined UML Class Diagram (with 3 compartments, fields and methods).

Application:

Write an application that receives and reads from a text file. Text file should be formatted as: BEGIN Square 2.0 Circle 1.5 Rectangle 3.0 4.0 Triangle 5.0 3.0 END

Once the application sees BEGIN, it should read the lines till it sees END. The purpose is to get the first word, determine which object to create, use the provided parameters to create the object, calculate its area (assume centimeters) and display the information in the console. So if we provide the text file shown above, then the output by calling each objects toString() method should be: The area of the square is 4.00 cm2 The area of the circle is 7.06 cm2 The area of the rectangle is 12.00 cm2 The area of the triangle is 7.50 cm2

The area formula for the objects: Square = side x side Circle = x r2 Rectangle = side1 x side2 Triangle = height x base / 2

You should create a Shape class as the parent of all and define common behavior. Children should override toString() method and implement their unique ways of calculating the area. Parent Shape class should be abstract and define area as an abstract method. There should be two constructors for each object: default constructor, which sets everything to 0 and a fully defined constructor which assigns fields as you pass the information as parameters. Use the file I provided for testing purposes

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!