add four more shape classes, Pyramid4 a 4-sided pyramid, Pyramid3 a 3-sided pyramid, Square, and Cube. You may add more shapes than these if you would like. Each new shape class will implement the ShapesInterface. You will then need to update the ShapeGenerator class to properly generate new objects of these classes. Note that the Test Driver class never creates variables of the shape classes. It is using variables of the ShapesInteface class to access the methods of the shape objects.

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

Please help to solve this codes.

In Java

add four more shape classes, Pyramid4 a 4-sided pyramid, Pyramid3 a 3-sided pyramid, Square,
and Cube. You may add more shapes than these if you would like.
Each new shape class will implement the ShapesInterface.
You will then need to update the ShapeGenerator class to properly generate new objects of these
classes.
Note that the Test Driver class never creates variables of the shape classes. It is using variables of
the ShapesInteface class to access the methods of the shape objects.
Transcribed Image Text:add four more shape classes, Pyramid4 a 4-sided pyramid, Pyramid3 a 3-sided pyramid, Square, and Cube. You may add more shapes than these if you would like. Each new shape class will implement the ShapesInterface. You will then need to update the ShapeGenerator class to properly generate new objects of these classes. Note that the Test Driver class never creates variables of the shape classes. It is using variables of the ShapesInteface class to access the methods of the shape objects.
package Shapes.src.objects Package;
import interface Package.Shapes Interface;
public class C one implements Shapes Interface {
private final double RADIUS;
private final double HEIGHT;
private final double SLANT LENGTH:
private final double SURFACE AREA
private final double VOLUME;
private final String SHAPE="Cone":
private final double Pl= Math.PI;
private final double BASE_AREA;
private final double CONE_AREA;
public Cone() {
}
}
public Cone(double pHeight, double pRadius){
}
private double calculate SlantLength) {
this.RADIUS= Math.random(* 10:
this.HEIGHT= Math.random(* 10:
this.SLANT_LENGTH= calculateSlantLength():
this.CONE_AREA = calculateC oneArea);
this.BASE_AREA = calculate BaseArea);
this.SURFACE AREA = calculate SurfaceArea:
this.VOLUME = calculateVolume:
}
private double calculate ConeArea() {
}
this.RADIUS=pRadius;
this.HEIGHT= pHeight;
this.SLANT_LENGTH= calculateSlantLength();
this.CONE_AREA = calculateC oneArea);
this.BASE_AREA = calculate BaseArea);
this.SURFACE_AREA = calculate Surface Area:
this.VOLUME = calculateVolume:
}
private double calculate BaseArea() {
return PI* RADIUS RADIUS;
}
private double calculate SurfaceArea() {
}
return Math.sqrt(RADIUS RADIUS + HEIGHT" HEIGHT);
}
private double calculate Volume(){
}
return PI RADIUS SLANT_LENGTH:
@Override
public double getArea() {
}
return this.BASE_AREA + this.CONE_AREA;
return (BASE_AREA HEIGHT)/3;
@Override
public double getVolume() {
return this.VOLUME;
}
return this.SURFACE_AREA;
@Override
public void display Area(){
units %n",SHAPE, SURFACE AREA);
System.out printf("This is a %s with an area of %32fsquare
@Override
public void displayVolume() {
units %n",SHAPE, VOLUME);
San
System.out.print("This is a %s with a volume of %3.2f cubic
}
public String toString() {
return SHAPE:
Transcribed Image Text:package Shapes.src.objects Package; import interface Package.Shapes Interface; public class C one implements Shapes Interface { private final double RADIUS; private final double HEIGHT; private final double SLANT LENGTH: private final double SURFACE AREA private final double VOLUME; private final String SHAPE="Cone": private final double Pl= Math.PI; private final double BASE_AREA; private final double CONE_AREA; public Cone() { } } public Cone(double pHeight, double pRadius){ } private double calculate SlantLength) { this.RADIUS= Math.random(* 10: this.HEIGHT= Math.random(* 10: this.SLANT_LENGTH= calculateSlantLength(): this.CONE_AREA = calculateC oneArea); this.BASE_AREA = calculate BaseArea); this.SURFACE AREA = calculate SurfaceArea: this.VOLUME = calculateVolume: } private double calculate ConeArea() { } this.RADIUS=pRadius; this.HEIGHT= pHeight; this.SLANT_LENGTH= calculateSlantLength(); this.CONE_AREA = calculateC oneArea); this.BASE_AREA = calculate BaseArea); this.SURFACE_AREA = calculate Surface Area: this.VOLUME = calculateVolume: } private double calculate BaseArea() { return PI* RADIUS RADIUS; } private double calculate SurfaceArea() { } return Math.sqrt(RADIUS RADIUS + HEIGHT" HEIGHT); } private double calculate Volume(){ } return PI RADIUS SLANT_LENGTH: @Override public double getArea() { } return this.BASE_AREA + this.CONE_AREA; return (BASE_AREA HEIGHT)/3; @Override public double getVolume() { return this.VOLUME; } return this.SURFACE_AREA; @Override public void display Area(){ units %n",SHAPE, SURFACE AREA); System.out printf("This is a %s with an area of %32fsquare @Override public void displayVolume() { units %n",SHAPE, VOLUME); San System.out.print("This is a %s with a volume of %3.2f cubic } public String toString() { return SHAPE:
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 1 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