C# VISUAL STUDIO CONSOLE App(.NET Framework)
Create an application named ShapesDemo that creates several objects that descend from an abstract class called GeometricFigure. Each GeometricFigure includes a height, a width, and an area. Provide get and set accessors for each field except area; the area is computed and is read-only. Include a method called ComputeArea() that computes the area of the GeometricFigure. Next you will create two additional classes derived from the GeometricFigure class Rectangle and Square.
Program:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ShapesDemo
{
abstract class GeometricFigure
{
public abstract double ComputeArea();
}
class Rectangle : GeometricFigure
{
double height, width,area;
public Rectangle(double height1,double width1)
{
setHeight(height1);
setWidth(width1);
}
public void setHeight(double height1)
{
height = height1;
}
public void setWidth(double width1)
{
width = width1;
}
public double getHeight()
{
return height;
}
public double getWidth()
{
return width;
}
public override double ComputeArea()
{
area= getHeight() * getWidth();
return area;
}
}
class Square : GeometricFigure
{
double width, area;
public Square(double width1)
{
setWidth(width1);
}
public void setWidth(double width1)
{
width = width1;
}
public double getWidth()
{
return width;
}
public override double ComputeArea()
{
area = getWidth() * getWidth();
return area;
}
}
class Program
{
static void Main(string[] args)
{
double height1, width1;
Console.WriteLine("Information of Geometric Figure - Rectangle:
");
Console.WriteLine("*************************************************"
+Environment.NewLine);
Console.Write("Enter Height of a Rectangle: ");
height1 = Convert.ToDouble(Console.ReadLine());
Console.Write("Enter Width of a Rectangle: ");
width1 = Convert.ToDouble(Console.ReadLine());
Rectangle rect = new Rectangle(height1,width1);
Console.WriteLine("Area of Rectangle: "+rect.ComputeArea());
Console.WriteLine(Environment.NewLine);
Console.WriteLine("Information of Geometric Figure - Square:
");
Console.WriteLine("*************************************************"
+ Environment.NewLine);
Console.Write("Enter Width of a Square: ");
width1 = Convert.ToDouble(Console.ReadLine());
Square sq = new Square(width1);
Console.WriteLine("Area of Square: " + sq.ComputeArea());
Console.ReadKey();
}
}
}
Output:

C# VISUAL STUDIO CONSOLE App(.NET Framework) Create an application named ShapesDemo that creates several objects that...
I've seen this one done as a console application, however I need some help setting it up as a windows form app using micrsoft visual c#. C# project - Create an application named ShapesDemo that creates several objects that descend from an abstract class called GeometricFigure. Each GeometricFigure includes a height, a width, and an area. Provide get and set accessors for each field except area; the area is computed and is read-only. Include an abstract method calledComputeArea() that computes...
C# visual studio 2019 For this you will create two student objects and then print out the objects values. Within the Student Class you will have the following properties: StudentID LastName FirstName Major Within the Main you will create 2 student objects by setting each of their property values. You will then write out a header line and each of the student objects to the console.
Using C#: Create an application class named BillDemo that instantiates objects of two classes named Bill and OverdueBill, and that demonstrates all their methods. The Bill class includes auto-implemented properties for the name of the company or person to whom the bill is owed and for the amount due. Also, include a ToString() method and returns a string that contains the name of the class (using GetType()) and the Bill’s data fields values. Create a child class named OverdueBill that...
PLEASE DO IN C# AND MAKE SURE I CAN COPY CODE IN VISUAL STUDIO Exercise #1: Design and implement class Rectangle to represent a rectangle object. The class defines the following attributes (variables) and methods: 1. Two Class variables of type double named height and width to represent the height and width of the rectangle. Set their default values to 1.0 in the default constructor. 2. A non-argument constructor method to create a default rectangle. 3. Another constructor method to...
Create a C# Console Application named Front that creates a new string from a user's entry. Take the first 3 characters of the given string and return the string with the 3 characters added at both the front and back. If the given string length is less than 3 do not accept the string
USING VISUAL BASIC STUDIO PLEASE PROVIDE THE CODE IN C# LANGUAGE SELECT CONSOLE APPLICATION You are to create a House with 2 rooms in the house. The following is an example of C++ code for the basic classes: **in C#, it may be written differently** class Room { private: double L; double W; public: //functions go here. } class House { private: Room room1; Room room2; public: //functions go here } The code above is C++ version. In C#, you...
C# for beginners (Methods and Properties, Data types) WorkStation:- Visual Studio 2019 Create a class called Invoice that a hardware store might use to represent an invoice for an item sold at the store. An Invoice should include four pieces of information as instance variables – a part number (type int), a part description (type string), a quantity of the item being purchased (type int) and a price per item (type decimal). Your class should have a constructor that initializes...
Include outputs. Write a C# console application named Tape that includes fields for length and width in inches and properties for each field. Also include a ToString() method that returns a string constructed from the return value of the object's GetType() method and the values of the length and width fields. Derive two subclasses - VideoCassetteTape and AdhesiveTape. The VideoCassetteTape class includes an integer field to hold playing time in minutes - a value from 1 to 180 - and...
C++ Visul Studio Create a class named Vehicle. The class has the following five member variables: • Vehicle Name • Vehicle number • Sale Tax • Unit price • Total price Include set (mutator) and get (accessor) functions for each field except the total price field. The set function prompt the user for values for each field. This class also needs a function named computePrice() to compute the total price (quantity times unit price + salesTax) and a function to...
Create a program named TilingDemo that instantiates an array of 10 Room objects and demonstrates its methods. The Room constructor requires parameters for length and width fields; use a variety of values when constructing the objects. The Room class also contains a field for floor area of the Room and number of boxes of tile needed to tile the room. Both of these values are computed by calling private methods. A room requires one box of tile for every 12...