UML Diagrams Shape (interface) + getPerimeter() : double + getArea(): double + getDetails() : void Triangle (implements Shape)| - sideA sint Circle (implements Shape) PI: float (final – 3.14) radius: int sideb sint sidec zint Rectangle (implements Shape) Square (implements Shape) - length : int - width : int is greater than width) (note that length side : int

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Java: Abstraction using Interface

 
UML Diagrams
Shape (interface)
+ getPerimeter() : double
+ getArea() : double
+ getDetails() : void
Triangle (implements Shape)
Circle (implements Shape)
- sideA :int
- sideb :int
- sidec :int
PI : float (final - 3.14)
radius: int
Rectangle (implements Shape)
Square (implements Shape)
- length : int
- width : int is greater than width)
(note that length
- side : int
Transcribed Image Text:UML Diagrams Shape (interface) + getPerimeter() : double + getArea() : double + getDetails() : void Triangle (implements Shape) Circle (implements Shape) - sideA :int - sideb :int - sidec :int PI : float (final - 3.14) radius: int Rectangle (implements Shape) Square (implements Shape) - length : int - width : int is greater than width) (note that length - side : int
Create a program that will String input.
Based on the number of inputs, the
program will decide what shape it is. (1
input
rectangle, 3 inputs - triangle). The program
will then display the shape type, details,
circle, 2 inputs
square or
perimeter and area.
Justines-MacBook-Pro:classes Justines java -jar Shape.jar 15
Type: Circle
Radius: 15
Perimeter: 94.2
Area: 706.5
Justines-MacBook-Pro:classes Justines java -jar Shape. jar 1z 24
Type: Rectangle
Length: 24
Width: 12
Perimeter: 72.0
Area: 288.0
Justines-MacBook-Pro:classes Justines java -jar Shape.jar 12 12
Type: Square
Side: 12
Perimeter: 48.e
Area: 144.0
Justines-MacBook-Pro:classes Justines java -jar Shape.jar 9 15 12
Type: Triangle
Sides: 9, 15, 12
Perimeter: 36.0
Area: 54.0
Justines-MacBook-Pro:classes Justines java -jar Shape. jar 9 15 12 8
Invalid input
Java File Layout
Shape/
E classes
E Circle.class
E Rectangle.class
E Shape.class
E Shape.jar
E Square.class
E TestShape.class
Triangle.class
manifest.txt
src
E Circle.java
E Rectangle. java
E Shape. java
E Square.java
E TestShape.java
- Triangle.java
2 directories, 14 files
Transcribed Image Text:Create a program that will String input. Based on the number of inputs, the program will decide what shape it is. (1 input rectangle, 3 inputs - triangle). The program will then display the shape type, details, circle, 2 inputs square or perimeter and area. Justines-MacBook-Pro:classes Justines java -jar Shape.jar 15 Type: Circle Radius: 15 Perimeter: 94.2 Area: 706.5 Justines-MacBook-Pro:classes Justines java -jar Shape. jar 1z 24 Type: Rectangle Length: 24 Width: 12 Perimeter: 72.0 Area: 288.0 Justines-MacBook-Pro:classes Justines java -jar Shape.jar 12 12 Type: Square Side: 12 Perimeter: 48.e Area: 144.0 Justines-MacBook-Pro:classes Justines java -jar Shape.jar 9 15 12 Type: Triangle Sides: 9, 15, 12 Perimeter: 36.0 Area: 54.0 Justines-MacBook-Pro:classes Justines java -jar Shape. jar 9 15 12 8 Invalid input Java File Layout Shape/ E classes E Circle.class E Rectangle.class E Shape.class E Shape.jar E Square.class E TestShape.class Triangle.class manifest.txt src E Circle.java E Rectangle. java E Shape. java E Square.java E TestShape.java - Triangle.java 2 directories, 14 files
Expert Solution
steps

Step by step

Solved in 7 steps with 11 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY