Answered step by step
Verified Expert Solution
Question
1 Approved Answer
write a java program as shown in the below class diagram then write the next main method and make your notes. extends public static void
write a java program as shown in the below class diagram then write the next main method and make your notes.
extends public static void main (String args [1) f Shape s1 - new Circle(5.5, "red", false); // Upeast System.out.println (s1); System.out.printin (s1.getArea ()); System.out.print1n (s1. getPerimeter ()): System. out.printin(s1.getcolor ()) ; System.out.println (s1. isFilled ()): System.out. println (s1. getRadius ())): Circle c1 = (Circle)sl: // Downcast system.out.println (cl); System, out.print1n (cl.getArea ()) ; system.out.printin (cl.getperimeter ()); System, out.printin (cl.getcolor()): system. out.println(c1.iseilled ()) ; system, out.printin (cl, getRadius ()) : Shape s2 = new Shape( ; Shape s3 = new Rectangle (1.0,2.0, "red", false ); System.out.println (s3): System.out.println (s3.getArea ()); System,out.print1n (s3.getperimeter ()); System.out.printin (s3.getcolor ()); system. out. printin (s3. get.Length ()); Rectangle x1= (Rectang1e) 33 ; System, out. printin(x1); Syatem. out. println ( x1. getArea ()); System.out.println (r1. getColor()); System, out. println (r1. getLength ()); Shape s4 = new square (6,6); System,out.println (s4); System.out.println (s4.getArea ()); System, ouc.println (s4.getcolor ()): System, out. println (s4. getside ()); Rectangle r2= (Rectangle 34; System, out. println (x2); System, out.println ( 2 , getArea 0) ); System, out. printin (r2. getColor ()): System.out.println (r2.getside ()); system,out.print1n (r2. getLength ( ) ); Square sq1 = (Square) x2; system. out. printin (sq1); System. out.println (sq1. getArea ()): System. out. print1n (sq1. getColor ()): System. out.print1n (sq1.getSide ()); System.out. println (sq1. gettength ()) ; \} Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started