Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

done in Java please make sure shape driver works as in example Introduction We have introduced Interface, Abstract Class, and Concurrent Class in Java. Abstract

done in Java please make sure shape driver works as in example image text in transcribed
image text in transcribed
image text in transcribed
Introduction 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 Shape Over mainString ved & Cava Class e Circle Class>> Triangle -radius: double of Circle(String) loString String computeAreal) double computer meter double readShapeData) void One Side: double two Sede double threeSide: double Triangle(String) toString String computerea double computePerimeter double ShapeDatavad > Triangle week2 cca Class Rt Triangle Circle(String) .toString String computereali double computePerimeter double readShapeData(void N one Side: double two Side: double threeSide: double Triangle(String) toString String computerea double computePerimeter() double readShapeatavoid > Rectangle weer *width: double height double d Rectangle(String .toString String computerea() double computePerimeter double readShapeuta) void base: double height double Triangle(String) toString String computerea double computePerimeter double readShapaDatavoid G Shape wee3 am Steing ShapeString geShapeName String String String computeromete dobe readShape (void topate Pageview A 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 ShapeDriver work can be as follows: EX: When I run ShapeDriver. 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, ShapeDriver 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 R+Triangle (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

Database Marketing The New Profit Frontier

Authors: Ed Burnett

1st Edition

0964535629, 978-0964535626

More Books

Students also viewed these Databases questions