Create a console-based application in C# called Farm Inventory App that meets the requirements below. 1. Create a class and name it Farm. 2. The Farm class must have the following properties: •Location as string •FarmSize as int •FarmCost as int 3. Define two constructors in the Farm class. The first constructor receives no argument and sets default values to the properties (the default value for string is an empty string, and for int it's 0). The second constructor must receive and set the values for Location, Farmsize, and FarmCost as arguments. 4. Create a method named ShowFarminformation in the class to display the properties of the object.
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Create a console-based application in C# called Farm Inventory App that meets the requirements below.
1. Create a class and name it Farm.
2. The Farm class must have the following properties:
•Location as string
•FarmSize as int
•FarmCost as int
3. Define two constructors in the Farm class.
The first constructor receives no argument and sets default values to the properties (the default value for string is an empty string, and for int it's 0).
The second constructor must receive and set the values for Location, Farmsize, and FarmCost as arguments.
4. Create a method named ShowFarminformation in the class to display the properties of the object.
Step by step
Solved in 3 steps with 1 images