In C Sharp, How do I get the output to display the objects : For Example: The area of a Rectangle is: 25Not : The area of ssullivan_A2_1.cs.Program+Rectangle is: 25    static void Main(string[] args)        {    ////Store the objects in a Collection object (List, Array, HashSet, etc...) objects in the collection will be of type Shape            Shapes[] arrayOfShapes = new Shapes[3];             arrayOfShapes[0] = new Circle(5);//             arrayOfShapes[1] = new Rectangle(5, 5);//             arrayOfShapes[2] = new Triangle(5, 3);//              //the values used to initialize the shape, the area, and the perimeter             foreach (Shapes objects in arrayOfShapes)            {// use arrayOfShapes to call methods               //The output should display the Object Type (Circle, Square or Triangle)             //the values used to initialize the shape, the area, and the perimeter                // Console.WriteLine(arrayOfShapes);                // use objects to call functions                 Console.WriteLine("The area of " + objects +  " is: " + objects.CalculateArea());                Console.WriteLine("The perimeter of this shape is: " + objects.CalculatePerimeter());// you have more than 1 print line need {}              }        }

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter14: Files And Streams
Section: Chapter Questions
Problem 17RQ
icon
Related questions
Question

In C Sharp, How do I get the output to display the objects : 
For Example: The area of a Rectangle is: 25
Not : The area of ssullivan_A2_1.cs.Program+Rectangle is: 25

 

 static void Main(string[] args)
        {    ////Store the objects in a Collection object (List, Array, HashSet, etc...) objects in the collection will be of type Shape
            Shapes[] arrayOfShapes = new Shapes[3];

            arrayOfShapes[0] = new Circle(5);// 
            arrayOfShapes[1] = new Rectangle(5, 5);// 
            arrayOfShapes[2] = new Triangle(5, 3);// 

            //the values used to initialize the shape, the area, and the perimeter 
            foreach (Shapes objects in arrayOfShapes)
            {// use arrayOfShapes to call methods 
 
             //The output should display the Object Type (Circle, Square or Triangle)
             //the values used to initialize the shape, the area, and the perimeter 
               // Console.WriteLine(arrayOfShapes);
                // use objects to call functions 
                Console.WriteLine("The area of " + objects +  " is: " + objects.CalculateArea());
                Console.WriteLine("The perimeter of this shape is: " + objects.CalculatePerimeter());// you have more than 1 print line need {} 

            }
        }

 

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Header Files
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT