Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

when i run TestShapes.java i get error could not find or load main class TestShapes. I am unable to figure out what is wrong with

when i run TestShapes.java i get error "could not find or load main class TestShapes.
I am unable to figure out what is wrong with my code. I need help fixing my java code. image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Go Tests Run Terminal Help Cedejovs - Java - Vil Studio Code Circle Jove Quality Assurance.java Rectangle.java Point java Shape java stubs(3) > stubs > Circle.java > Circle > toStringo public class Circle extends Shape private double radius; public circle( double x, double y, double radius ) { //INSERT YOUR CODE HERE super (x,y); this.radius -radius; 1 2 3 4 5 public double getRadius() { 1/INSERT YOUR CODE HERE return radius; public void setRadius( double radius ) { //INSERT YOUR CODE HERE this.radius -radius; 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 public boolean equals( Shape other) //INSERT YOUR CODE HERE if (this - other) return true; if (other - null || getClass() t-other-getClass()) return false; Circle circle - (Circle) other; return Double.compare(circle., *) - 88 Double.compare(circle.y, y) - 4 Double.compare(circle.radius, radius) - public String toString() //INSERT YOUR CODE HERE return "Located at: (* * * ," + x +")" TestShapes. Go Run Terminal Help Ponteve. Viel Stadio Code Cirdejava Quality Assurance Rectangle.jne Pointer Shape jave stub53) > stubs > Pointje > Point > Point double double 1 public class Point 2 3 private double x, y: 4 public point( double x, double y ) //DISERT YOUR CODE HERE this.x - 3 this.y - Y3 public void setxt double x ) { //INSERT YOUR CODE HERE this.XX 10 11 22 13 14 public void sety double y ) //INSERT YOUR CODE HERE this.y - y 16 17 28 19 20 22 22 23 24 public double getxo) //INSERT YOUR CODE HERE return x; ) public double gety //INSERT YOUR CODE HERE return y 26 27 28 29 30 31 public boolean equals point other ) { //INSERT YOUR CODE HERE return other. y-other.y. } public String tostring() { //INSERT YOUR CODE HERE return String.format("(%.2f, 1.2f", 2,9) . Go Run Terminal Help Rectangle - Java - Vua Suso Code - Circle.java Quality Assurance java Rectanglejere Point.java Shape jave stubs_) > stubs > Rectangle Java > ts Rectangle > equals(shape) 1 public class Rectangle extends Shape { TestShapes.java 2 3 4 private double length, width: public Rectangle( double x, double y, double length, double width ) //INSERT YOUR CODE HERE super(x,y); this.length.length this.width = width 12 public double getLength() { //INSERT YOUR CODE HERE return length 13 14 15 16 17 public double getwidth() { //INSERT YOUR CODE HERE return width; public void setlength double length) { //INSERT YOUR CODE HERE this.length-length; 19 20 21 22 24 25 26 27 29 public void setuidth double width ) { //INSERT YOUR CODE HERE this.width - width; public boolean equals Shape other) //INSERT YOUR CODE HERE Rectangle rect - (Rectangle) other if(this.length I rect.length) return false; if (this.width 1-rect.width) return false; return true; public string tostring() { //INSERT YOUR CODE HERE return super.tostring() + length length, width*width: Shemal Studio Code Point java. Shape TestShapesjave View Go Run Terminal Help Code.java Assurance java Rectanglejme stus (3) stubs > Shape jare > Shape > Below Shape 1 public abstract class Shape { 2 3 private point location; public shapel double x, double y ) 5 //INSERT YOUR CODE HERE locatione new Point(X, Y); > public void setLocation point point ) { //INSERT YOUR CODE HERE 10 location - point; 11 ) 12 public point getLocation() { 13 1/SERT YOUR CODE HERE 14 return locations 15 16 17 public boolean isteftoft Shape other ) { 19 if( other = null) { 20 return false; 21 } else { 22 - other.getLocation(); 23 return location.getX() point //INSERT YOUR CODE HERE - Hint from isleftof(...) if(other null){ 31 32 33 36 35 36 37 return false; ) else Point prother.getLocation(); return location.getX()>p.getX(); blic honlanishushanther V SO w Go Run Terminal Help Shapejava - Java - Visual Studio Circle.java Quality Assurance.java Rectangle.java Point.java She stubs(3) > stubs > Shape.java > Shape > isBelow(Shape) public boolean isAbove Shape other ) { 41 // INSERT YOUR CODE HERE - Hint from isleftof(...) if(other--null){ return false; 39 40 42 43 44 45 46 47 48 49 50 51 52 53 54 } else{ Point peother.getLocation(); return location.getY()>p.getY(); } 55 } public boolean isBelow Shape other ) { //INSERT YOUR CODE HERE - Hint from isleftof(...) if(other=null){ return false; 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 elsel Point peother.getLocation(); return location.getY() stubs > Shapejava > Shape > IsBelow(Shape) 56 public boolean isBelow Shape other ) { 57 58 //INSERT YOUR CODE HERE - Hint fron isLeftof(...) 59 if(other null) 60 61 return false; 62 63 64 else 65 66 point p-other.getLocation() 67 68 return location.getY()p.getY(); 86 87 88 89 90 91 Go Amaral Help E Ordnjave QAX Rectanglejova. Pod Shapes > Quality Anjave > ts QualityAnce > 910 7 public class Qualityssurance 9 30 11 //testing point object public static boolean(10 boolean answer new boolean(); Polet pl - new Point 2.e, 3.0); Point p = new Point 2., 3.4 ) answer (0) - pi.equals(pai 1, 2HP) pl.sety 3.98756 ): an) - Ipl.equals(p); answe(2) - pl.getX() 2.3456783 answej - pl.getY() - 3.587565 answer [*] -pa.tostrinet).quals(int x 2.345678, y: 3.987563") 17 return answers //testing the circle object public static boolean1 20 boolean answer new boolean(); Point pl Point 2.0, 1.4) Circle a new Circle pl.getX(), pi.getY(), 45.356 ) answer() - d.getLocation().getX() - 2.6; a c.getLocation().getY() - 3.43 ase) - c.getradius) - 45.3563 Shu a new Circle pig(). p.getY(), 55.356 ) answer - I d.equals( 2 ) answer - d.toString().equals("Circle (X1 2.0, y: 3.4; radius 15.356]"); return anter's //testing the rectangle object public static boolean() () 45 IN TOWN 47 49 53 Rum Terminal Help Qualitnej. Vi Studio Code Cirdejava Quality Assurance Java X Rectangle.java Point.jave Shape jave TestShapes.jave stubs_) > stubs > Quality Assurancejavo > Quality Assurance > 010 44 public static boolean[() { 45 46 boolean answer = new boolean [6); Point pl - new Point( 2.0, 3.4) 48 Rectangle = new Rectangle( pi.getX(), pi.getY(), 45.356, 28.56 ); answer() - r.getLocation().getX() - 2.0; answer(2) - r.getLocation().getY() - 3.4) 51 answer [2] -ri.getLength() -- 45.356; 52 answer(3) - Mi.getwidth() - 28.56) Share 2 new Rectangle( pi.getX(), pi.getY(), 55.356, 26.57 ) 54 answer [4] - I ri.equals( 12 ) 55 answer [5] - m.tostring().equals("Rectangle [x: 2.e, y: 3.4; length: 45.356, width: 28.563"); 56 57 return answers } 59 60 //testing the shape object 61 public static boolean) 040) 62 boolean ) answer new boolean[7]; 64 Point pl = new Point( 2.0, 3.4 ); 65 Shape ri - new Rectangle pi.getX(), pi.getY(), 45.35, 28.56 ); Share r2 = new Rectangle pi.getX(), pi.getY(), 45.35, 28.56 ) 67 68 answer[@] - I misteftof(ra); 69 answer (1) - I ri.isRightof( 12 ); 70 answer [2] -ri.isAtSamopoints( r2 ) 71 72 pl = new Point(2.5, 5.0); 73 r2 = new Rectangle pi.getX(), pi.getY(), 45.35, 28.56 ) 74 anser[3) - Mi.isLeftof( 2 ) answer(4) - Iri.isRightof( r2 ) 76 answer(5) - ri.isBelow r2 ); 77 answer [6] - r2.isAbove(i); 78 79 return answers 81 82 LA 1 Col 66 Cadea & Curleyesu Rectangle Post Shape bet > Thesje > tseseshapes 1 public class Testshapes 2 1 Run Debug 3 public static void main(string()) Piet pl - new point( 2.0, 3.4 ) Point 2 w Point( 2.0, 3.4) System.out.println("pi.. ) System.out.print2n(p2 pa) System.out.println("pa.equals( 2 ) Ispi.equals a ) ) p2 new Point( 2.5, 1.4) 12 13 Sara-nex Sirslet pl.getX(), pi.gety). 45.356 ): Systes.out.println( a ). Shani - new Rectanglet p.get(), pi.gety), 45.5, 29.56 ) Systes.out.println(i) 15 16 17 10 119 20 System.out.println("pi *.pl): System.out.println("p2 ..): System.out.println("pa.equals(pa) ispi.equals(p2); System.out.println("c.equals() is d.equals()); System.out.println("c.equals( a ) is cl.equals( a ) ); System.out.println("") pl-new Point(2.0, 3.4) Shape 12 new Rectangle pi.getX(), pi.get(), 45.35, 23.56 ) System.out.println("..) System.out.println("r2 -.-2) System.out.println("ri. Isleftof( 12 ) is ri. Isleftof( 12 ): System.out.println("ri.isrightof( 12 ) is ri.iskighof ( 2 ) ): System.out.println("ru. Istomer int(12) is ri.isata Points 12 ) ): pl - new Point(2.5, 5.0); r2 = new Rectale pi.getX(), pl.getY(). 45.35, 23.56 ) Systes.out.println("ri..) System.out.println("2. r2); System.out.println("1. isteftof( 12 ) is. Este tof( 12 ) ) System.out.println("1. Istighof ( 12 ) is nisightof( 2 ) ) Strautnintelisteloosneler K LA 2. Colum. O Rum Terminal Help Te Shaw Code Cinde Qualitykarunan Rectangle Proleter shapejer stu) stubs > Shapes.jave > TestShapes >mainring E Shapes 17 18 19 20 21 22 2) 25 System.out.println(pl. pi ) Systes.out.println("p2 . *p2 ) System.out.println("pa.equals( pa ) ispi.equals( 2 ) ) System.out.println(d.equals( i ) isci.equals()); System.out.println(a.equalscu) is "c.equals( a ) ) System.out.println(" "); pl - new Point(2.0, 3.4); Shape 2 new Rectangle( pl.getX(), p.getY(), 45.35, 28.56 ) System.out.println("1. mi) System.out.println("r2.. r2), System.out.println("ri.is eftof( 12 ) is. Isleftof( 12 ) ) System.out.println("ra.isRightof(r2 ) isisight of 12 ) ) System.out.println(".isAtSamePoints( r2 ) is ri.sAtSamontas(2) 27 20 29 30 plenew Point(2.5, 5.0); 12 - Bectangle pi.getxe), pi.getY(). 45.35, 23.56 ): System.out.println("r.) System.out.println("r2 - - 2) System.out.println("riskeftoft 2) is niseftof( 12 ) ): System.out.println("r1.isrightof r2 ) is nisightof( 12 ) ), System.out.println("ra. Iselov 2 ) is r.stelow 12 ) ) System.out.println("ra.isAbove ri) is r2.is bove( ) System.out.println(" "); boolean) test - Grade testos Gradel sb.gradec.ab(test) Cha UTF-ORL o ' N C:\Users\adesino\Documents\UFV\COMP 155\Labs\Lab 5>java TestShapes p1 - Point [x: 2.0, y: 3.4] P2 - Point [x: 2.0, y: 3.4) pi.equals( p2) is true Circle [x: 2.0, y: 3.4; radius: 45.356] Rectangle [x: 2.0, y: 3.4; length: 45.35, width: 28.56] pi - Point (x: 2.0, y: 3.4] p2 - Point (x: 2.5, y: 3.4) pi.equals( p2 ) is false c1.equals( r ) is false c1.equals( c1 ) is true 11 - Rectangle [x: 2.0, y: 3.4; length: 45.35, width: 28.56] r2 - Rectangle [x: 2.0, y: 3.4; length: 45.35, width: 28.56] ri.isLeftof( 2 ) is false ri.isRightof r2) is false r1.isAtSamePointAs( r2 ) is true ri - Rectangle [x: 2.e, y: 3.4; length: 45.35, width: 28.56] r2 - Rectangle [x: 2.5, y: 5.0; length: 45.35, width: 28.56] ri.isLeftof( 2 ) is true r1.isRightOf(r2 ) is false ri.isBelow r2is true r2. isAbove ri ) is true test e passed. test 1 passed. test 2 passed. test 3 passed. All tests are successful. Total points earned in this lab: 90.0

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

Samsung Galaxy S23 Ultra Comprehensive User Manual

Authors: Leo Scott

1st Edition

B0BVPBJK5Q, 979-8377286455

More Books

Students also viewed these Databases questions

Question

e. What do you know about your ethnic background?

Answered: 1 week ago

Question

b. Why were these values considered important?

Answered: 1 week ago