The document describes adding controls and classes to a form application to calculate the perimeter and area of squares and rectangles. Radio buttons are added to select square or rectangle, with text boxes for length and width. Classes are created for Rectangle and Square, with Square inheriting from Rectangle. On a button click, the appropriate class is instantiated and its perimeter and area methods called and displayed in a message box. The homework is to extend this to calculate perimeter and area of different types of triangles using inheritance.
The document describes adding controls and classes to a form application to calculate the perimeter and area of squares and rectangles. Radio buttons are added to select square or rectangle, with text boxes for length and width. Classes are created for Rectangle and Square, with Square inheriting from Rectangle. On a button click, the appropriate class is instantiated and its perimeter and area methods called and displayed in a message box. The homework is to extend this to calculate perimeter and area of different types of triangles using inheritance.
The document describes adding controls and classes to a form application to calculate the perimeter and area of squares and rectangles. Radio buttons are added to select square or rectangle, with text boxes for length and width. Classes are created for Rectangle and Square, with Square inheriting from Rectangle. On a button click, the appropriate class is instantiated and its perimeter and area methods called and displayed in a message box. The homework is to extend this to calculate perimeter and area of different types of triangles using inheritance.
Kvadrat.cs using System; using System.Collections.Generic; using System.Linq; using System.Text;
namespace Trigonometrija { class Kvadrat : Pravougaonik { public Kvadrat() { } public Kvadrat(double aa) : base(aa, aa) { } } }
Kod koji se dodaje u pozadinu forme je sledei:
Form1.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;
namespace Trigonometrija { public partial class Form1 : Form { public Form1() { InitializeComponent(); txtStranicaB.Enabled = false; }