Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please make sure ShapeDriver is done properly. Do in Java. We have introduced Interface, Abstract Class, and Concurrent Class in Java. Abstract class and interface

Please make sure ShapeDriver is done properly. Do in Java.

image text in transcribedimage text in transcribed

We have introduced Interface, Abstract Class, and Concurrent Class in Java. Abstract class and interface have usage cases. In this homework, you will practice some of the concepts by writing a program or one or two sentences. Task #1 Write a program that has several desired functionalities. 1. Create a Shape.java Abstract class and the other classes as Concurrent classes as shown in figures. Other classes such as Rectangle extends Shape class. > Shape Driver week3 Shape Driver) o main(String) void > Circle week3 -radius: double Circle(String) otoString0 String computeArea().double computePerimeter().double readShapeData() void > Triangle week3 - oneSide: double two Side: double three Side: double Triangle(String) .toString(): String computeArea().double computePerimeter().double readShapeData()void > Rt Triangle week3 base: double height: double FRtTriangle(String) toString) String computeArea() double computePerimeter double readShapeData() void > Shape week3 - name: String Shape(String) getShapeName(): String otoString(): String computeArea().double computePerimeter().double read ShapeData() void 2. Implementation of two classes are in your textbook, and detail information about the methods are also there. Implement the rest of the classes. However, you should implement in a way that, the user enters the required parameters to program so that the required area, ... calculated according to shape type. In Shape abstract class, all methods are abstract except getShapeName method. You need to implement abstract methods in the concurrent classes. All attributes are private. 3. readShapeData() method in each class gets the required input/inputs from a user by handling exception cases. 4. Create a driver class called Shape Driver which is a concurrent class. You need to implement in a way that it can do operation on a correct shape according to user selection. For example, the flow of how Shape Driver work can be as follows: EX: When I run Shape Driver. It will ask me the shape name as follow: **Please enter the shape name:" After I write "rec, it will call the Rectangle class and Rectangle class asks me to enter the width and height in double format as follows: "Please enter width and height: Assume I enter 4.5 5.6, it will calculate the perimeter and area and print out the information as follows: "Rectangle width: 4.5, height: 5.6, perimeter: 20.2, area: 25.2" However, if I enter the wrong information, type, any non-logical inputs, Shape Driver should provide enough information what I am doing wrong and handle all cases. Then, Shape Driver should request from me to enter the shape name and continue. You have to catch the error if there is. Your program should not terminate until I write "***" for shape name. Think about if I enter so big number and different formats to handle Similar to rectangle, if I enter "cir, it will call Circle class, if I enter "rtTri", it will call RtTriangle (Right Triangle), and if I enter "tri, it will call Triangle class to get required parameters from the user and show the results. If I enter "***" for shape name, the program should be terminated. Please think carefully while you are developing your program and under which conditions the given parameters satisfy the shape requirements (Triangle inequality). We have introduced Interface, Abstract Class, and Concurrent Class in Java. Abstract class and interface have usage cases. In this homework, you will practice some of the concepts by writing a program or one or two sentences. Task #1 Write a program that has several desired functionalities. 1. Create a Shape.java Abstract class and the other classes as Concurrent classes as shown in figures. Other classes such as Rectangle extends Shape class. > Shape Driver week3 Shape Driver) o main(String) void > Circle week3 -radius: double Circle(String) otoString0 String computeArea().double computePerimeter().double readShapeData() void > Triangle week3 - oneSide: double two Side: double three Side: double Triangle(String) .toString(): String computeArea().double computePerimeter().double readShapeData()void > Rt Triangle week3 base: double height: double FRtTriangle(String) toString) String computeArea() double computePerimeter double readShapeData() void > Shape week3 - name: String Shape(String) getShapeName(): String otoString(): String computeArea().double computePerimeter().double read ShapeData() void 2. Implementation of two classes are in your textbook, and detail information about the methods are also there. Implement the rest of the classes. However, you should implement in a way that, the user enters the required parameters to program so that the required area, ... calculated according to shape type. In Shape abstract class, all methods are abstract except getShapeName method. You need to implement abstract methods in the concurrent classes. All attributes are private. 3. readShapeData() method in each class gets the required input/inputs from a user by handling exception cases. 4. Create a driver class called Shape Driver which is a concurrent class. You need to implement in a way that it can do operation on a correct shape according to user selection. For example, the flow of how Shape Driver work can be as follows: EX: When I run Shape Driver. It will ask me the shape name as follow: **Please enter the shape name:" After I write "rec, it will call the Rectangle class and Rectangle class asks me to enter the width and height in double format as follows: "Please enter width and height: Assume I enter 4.5 5.6, it will calculate the perimeter and area and print out the information as follows: "Rectangle width: 4.5, height: 5.6, perimeter: 20.2, area: 25.2" However, if I enter the wrong information, type, any non-logical inputs, Shape Driver should provide enough information what I am doing wrong and handle all cases. Then, Shape Driver should request from me to enter the shape name and continue. You have to catch the error if there is. Your program should not terminate until I write "***" for shape name. Think about if I enter so big number and different formats to handle Similar to rectangle, if I enter "cir, it will call Circle class, if I enter "rtTri", it will call RtTriangle (Right Triangle), and if I enter "tri, it will call Triangle class to get required parameters from the user and show the results. If I enter "***" for shape name, the program should be terminated. Please think carefully while you are developing your program and under which conditions the given parameters satisfy the shape requirements (Triangle inequality)

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

Probabilistic Databases

Authors: Dan Suciu, Dan Olteanu, Christopher Re, Christoph Koch

1st Edition

3031007514, 978-3031007514

More Books

Students also viewed these Databases questions