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 {}              }        }

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education