NEED HELP WITH JAVA PROGRAM ERROR PLEASE HELP THANK YOU   CODE: class quad{ public static void main(String args[] ){ Quadrilateral quadrilateral = new Quadrilateral( 1.1, 1.2, 6.6, 2.8, 6.2, 9.9, 2.2, 7.4 ); Trapezoid trapezoid = new Trapezoid (0.0, 0.0, 10.0, 0.0, 8.0, 5.0, 3.3, 5.0 ); Parallelogram parallelogram = new Parallelogram (5.0, 5.0, 11.0, 5.0, 12.0, 20.0, 6.0, 20.0 ); Rectagle rectagle = new Rectagle(17.0, 14.0, 30.0, 14.0, 30.0, 28.0, 17.0, 28.0 ); Square square = new Square( 4.0, 0.0, 8.0, 0.0, 8.0, 4.0, 4.0, 4.0 ); System.out.printf("%s %s %s %s %s\n", quadrilateral, trapezoid, parallelogram, rectagle, square ); } } class Point{ private double x; private double y; public Point(double xCoordinate, double yCoordinate){ x = xCoordinate; y = yCoordinate; } public double getX(){ return x; } public double getY(){ return y; } public String toString(){ return String.format( "( %.1f, %.1f)", getX(), getY() ); } } class Quadrilateral { private Point point1; private Point point2; private Point point3; private Point point4; public Quadrilateral( double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4){ point1 = new Point( x1, y1 ); point2 = new Point( x2, y2 ); point3 = new Point( x3, y3 ); point4 = new Point( x4, y4 ); } public Point getPoint1(){ return point1; } public Point getPoint2(){ return point2; } public Point getPoint3(){ return point3; } public Point getPoint4(){ return point4; } public String toString(){ return String.format( "%s:\n%s","COORDINATES OF QUADRILATERAL ARE: ", getCoordinatesAsString() ); } public String getCoordinatesAsString(){ return String.format("%s,%s,%s,%s,%s\n", point1, point2, point3,point4 ); } } class Trapezoid extends Quadrilateral { private double height; public Trapezoid(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4){ super(x1, y1, x2, y2, x3, y3, x4, y4); } public double getHeight(){ if (getPoint1().getY() == getPoint2().getY() ) return Math.abs( getPoint2().getY() - getPoint3().getY() ); else return Math.abs( getPoint1().getY() - getPoint2().getY() ); } public double getArea(){ return getSumOfTwoSides() * getHeight() / 2.0; } public double getSumOfTwoSides(){ if (getPoint1().getY() == getPoint2().getY() ) return Math.abs( getPoint1().getX() - getPoint2().getX() ) + Math.abs( getPoint3().getX() - getPoint4().getX() ); else return Math.abs( getPoint2().getX() - getPoint3().getX() )+ Math.abs( getPoint4().getX() - getPoint1().getX() ); } public String toString() { return String.format("\n%s:\n%s: %s\n%s: %s\n", "COORDINATES OF TRAPEZOID ARE", getCoordinatesAsString(), "Height is:", getHeight(), "Area is:", getArea() ); } } class Parallelogram extends Trapezoid{ public Parallelogram( double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4 ){ super ( x1, y1, x2, y2, x3, y3, x4, y4); } public double getWidth(){ if (getPoint1().getY() == getPoint2().getY() ) return Math.abs( getPoint1().getX() - getPoint2().getX() ); else return Math.abs( getPoint2().getX() - getPoint3().getX() ); } public String toString(){ return String.format( "\n%s:\n%s%s: %s\n%s: %s\n%s: %s\n","COORDINATES OF PARALELLOGRAM ARE:",getCoordinatesAsString(), "Width is", getWidth(),"Height is", getHeight(),"Area is:", getArea() ); } } class Rectagle extends Parallelogram{ public Rectagle( double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4 ){ super ( x1, y1, x2, y2, x3, y3, x4, y4); } public String toString(){ return String.format( "\n%s:\n%s%s: %s\n%s: %s\n%s: %s\n","COORDINATES OF RECTAGLE ARE:",getCoordinatesAsString(), "Width is", getWidth(),"Height is", getHeight(),"Area is:", getArea()); } } class Square extends Parallelogram{ public Square( double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4 ){ super ( x1, y1, x2, y2, x3, y3, x4, y4); } public String toString(){ return String.format( "\n%s:\n%s%s: %s\n%s: %s\n%s: %s\n","COORDINATES OF SQUARE ARE:",getCoordinatesAsString(), "Width is", getWidth(),"Height is", getHeight(),"Area is:", getArea() ); } }

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

NEED HELP WITH JAVA PROGRAM ERROR

PLEASE HELP THANK YOU

 

CODE:

class quad{
public static void main(String args[] ){

Quadrilateral quadrilateral = new Quadrilateral( 1.1, 1.2, 6.6, 2.8, 6.2, 9.9, 2.2, 7.4 );

Trapezoid trapezoid = new Trapezoid (0.0, 0.0, 10.0, 0.0, 8.0, 5.0, 3.3, 5.0 );

Parallelogram parallelogram = new Parallelogram (5.0, 5.0, 11.0, 5.0, 12.0, 20.0, 6.0, 20.0 );

Rectagle rectagle = new Rectagle(17.0, 14.0, 30.0, 14.0, 30.0, 28.0, 17.0, 28.0 );

Square square = new Square( 4.0, 0.0, 8.0, 0.0, 8.0, 4.0, 4.0, 4.0 );

System.out.printf("%s %s %s %s %s\n", quadrilateral, trapezoid, parallelogram, rectagle, square );
}
}
class Point{
private double x;
private double y;

public Point(double xCoordinate, double yCoordinate){
x = xCoordinate;
y = yCoordinate;
}
public double getX(){
return x;
}
public double getY(){
return y;
}
public String toString(){
return String.format( "( %.1f, %.1f)", getX(), getY() );
}
}
class Quadrilateral {
private Point point1;
private Point point2;
private Point point3;
private Point point4;

public Quadrilateral( double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4){
point1 = new Point( x1, y1 );
point2 = new Point( x2, y2 );
point3 = new Point( x3, y3 );
point4 = new Point( x4, y4 );
}
public Point getPoint1(){
return point1;
}
public Point getPoint2(){
return point2;
}
public Point getPoint3(){
return point3;
}
public Point getPoint4(){
return point4;
}
public String toString(){
return String.format( "%s:\n%s","COORDINATES OF QUADRILATERAL ARE: ", getCoordinatesAsString() );
}
public String getCoordinatesAsString(){
return String.format("%s,%s,%s,%s,%s\n", point1, point2, point3,point4 );
}
}
class Trapezoid extends Quadrilateral {
private double height;
public Trapezoid(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4){
super(x1, y1, x2, y2, x3, y3, x4, y4);
}
public double getHeight(){
if (getPoint1().getY() == getPoint2().getY() )
return Math.abs( getPoint2().getY() - getPoint3().getY() );
else
return Math.abs( getPoint1().getY() - getPoint2().getY() );
}
public double getArea(){
return getSumOfTwoSides() * getHeight() / 2.0;
}
public double getSumOfTwoSides(){
if (getPoint1().getY() == getPoint2().getY() )
return Math.abs( getPoint1().getX() - getPoint2().getX() ) +
Math.abs( getPoint3().getX() - getPoint4().getX() );
else
return Math.abs( getPoint2().getX() - getPoint3().getX() )+
Math.abs( getPoint4().getX() - getPoint1().getX() );
}
public String toString() {
return String.format("\n%s:\n%s: %s\n%s: %s\n", "COORDINATES OF TRAPEZOID ARE", getCoordinatesAsString(), "Height is:", getHeight(), "Area is:", getArea() );
}
}
class Parallelogram extends Trapezoid{
public Parallelogram( double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4 ){
super ( x1, y1, x2, y2, x3, y3, x4, y4);
}
public double getWidth(){
if (getPoint1().getY() == getPoint2().getY() )
return Math.abs( getPoint1().getX() - getPoint2().getX() );
else
return Math.abs( getPoint2().getX() - getPoint3().getX() );
}
public String toString(){
return String.format( "\n%s:\n%s%s: %s\n%s: %s\n%s: %s\n","COORDINATES OF PARALELLOGRAM ARE:",getCoordinatesAsString(), "Width is", getWidth(),"Height is", getHeight(),"Area is:", getArea() );
}
}
class Rectagle extends Parallelogram{
public Rectagle( double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4 ){
super ( x1, y1, x2, y2, x3, y3, x4, y4);
}
public String toString(){
return String.format( "\n%s:\n%s%s: %s\n%s: %s\n%s: %s\n","COORDINATES OF RECTAGLE ARE:",getCoordinatesAsString(), "Width is", getWidth(),"Height is", getHeight(),"Area is:", getArea());
}
}
class Square extends Parallelogram{
public Square( double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4 ){
super ( x1, y1, x2, y2, x3, y3, x4, y4);
}
public String toString(){
return String.format( "\n%s:\n%s%s: %s\n%s: %s\n%s: %s\n","COORDINATES OF SQUARE ARE:",getCoordinatesAsString(), "Width is", getWidth(),"Height is", getHeight(),"Area is:", getArea() );
}
}

Console: connection closed
Exception in thread "main" java.util.MissingFormatargumentException: Format spea
ifier '%s'
at java.base/java.util.Formatter.format(Formatter.java:2672)
at java.base/java.util.Formatter.format(Formatter.java:2609)
at java.base/java.lang.String.format(String.java:2897)
at Quadrilateral.getcoordinatesAsstring(quad.java:63)
at Quadrilateral.tostring(quad.java:60)
at java.base/java.util.Formatter$Formatspecifier.printstring(Formatter.
ava:3031)
at java.base/java.util.Formatter$Formatspecifier.print(Formatter.java:2
e8)
at java.base/java.util.Formatter.format(Formatter.java:2673)
at java.base/java.io.Printstream.format(Printstream.java:1053)
at java.base/java.io.Printstream.printf(Printstream.java:949)
at quad.main(quad.java:14)
Transcribed Image Text:Console: connection closed Exception in thread "main" java.util.MissingFormatargumentException: Format spea ifier '%s' at java.base/java.util.Formatter.format(Formatter.java:2672) at java.base/java.util.Formatter.format(Formatter.java:2609) at java.base/java.lang.String.format(String.java:2897) at Quadrilateral.getcoordinatesAsstring(quad.java:63) at Quadrilateral.tostring(quad.java:60) at java.base/java.util.Formatter$Formatspecifier.printstring(Formatter. ava:3031) at java.base/java.util.Formatter$Formatspecifier.print(Formatter.java:2 e8) at java.base/java.util.Formatter.format(Formatter.java:2673) at java.base/java.io.Printstream.format(Printstream.java:1053) at java.base/java.io.Printstream.printf(Printstream.java:949) at quad.main(quad.java:14)
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 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