Excercise practicing the implementation of abstract class and Interface Need Help | Selenium C# Forum
P
Prashanth Gudavalli Posted on 07/03/2019

Create a console application and take the input from console, make sure you do all the validation for the input. The console first asks which shape we want to calculate and then it will ask the inputs, make the app endless unless we type “exit”(case insensitive).

  1. Create a basic function to calculate the dimensions of a rectangle, and display on the console.
  2. Create a basic function to calculate the dimensions of a triangle, and display on the console.
  3. Create a basic function to calculate the dimensions of a circle, and display on the console.
  4. Use inheritance in c# to improve the project(You can think of override, interface or abstract maybe?).
  5. Make use of “Models” in c#.
  6. Make use of auto setter.
  7. Make use of constructor and base.

I was trying to do this practice exercise in C#. I created the classes for all the shapes(Circle, rectangle and triangle). And able to execute it in the programme class main function(Result: The console asks me the dimensions of each shape and calculate the result one by one). But I want to improvise my code using the abstract or interface. Please give me some hints so that I will proceed. I went throught basics of the polymorphism concepts and a kind of stuck while implementing these. Could you please help me what steps should I take to use those concepts.

 

Also please suggest few excercises to practice on the above concepts. Appreciated.


G
gunjan Replied on 09/03/2019

These concepts are explained in the first seven modules of our selenium c# course. Please watch the videos once.