Wednesday, 24 April 2013

Diaz Entertainment, Inc. has to develop a software application for young children that would enable them to identify and distinguish shapes and colors. The application should ask the name of the shape, its area, and color. Once the input is provided, the application should draw the shape with the same area and color as entered by the user. You, as part of the development team, have to define the Geometrical_Shapes class that should have methods to accept the input from the users, display the input as entered by the user, and display the shapes with the same color and area. You have written the following code: class Geometrical_Shapes { Double Area; string shape; string Color; public: void GetInput () { //Code to accept the user inputs and store the values in //the corresponding variables } void Display() { //Code to display the details of the shape such as //no_of_coordinates, area, and color } } You thought of showing this class to your supervisor before adding the method to draw the shapes. However, your supervisor told you that the class definition contains errors. In addition, he asked you to complete the methods. Now, you need to fix the errors and complete the GetInput() and Display() methods. You also need to write the Main() method so that the code can be compiled and executed.



using system;
class Geometrical_shapes
{
    double Area;
    string Shape;
    string color;
 public void GetInput()
{
   console.write("Enter the of the Shape:");
   Shape = console.ReadLine();
   console.Write("Enter the Color:");
   Color = Console.ReadLine();
   Console.Write("Enter the Area:");
   Area = Console.ToDouble(console.ReadLine());
}
Publicvoid Display ()
{
   Console.WriteLine();
   Console.WriteLine("THISIS WHAT YOU ENTERED: \n");
   console.write("Name of the Shape:");
   console.WriteLine(Shape);
   console.write("Color:");
   Console.WriteLine("Color");
   Console.write("Area:");
   Console.writeLine(Area);
  }
}
class Classy
{
 static void Main(string[]args)
{
 Geometrical Shapes_Small_rectangle = new Geometrical_Shapes();
 Small rectangle.Create();
 Small rectangle.Display();
 Console.ReadLine();
  }
}





















 

 

No comments:

Post a Comment