Paul Agighioleanu

Paul Agighioleanu

  • 1.9k
  • 3
  • 206

make an class “employee” with the atributes “name” and “sala

Jul 6 2019 2:04 PM
can someone show me some examples with this class of constructors, methods and overload ??
 
define 2 employee and for the first one to rais the salary, then display the employees.
 
i`m very new to programming, i want to learn c#
 
and i want to know if i started right
  1. using System;  
  2. namespace ConsoleApp1  
  3. {  
  4. class employee  
  5. {  
  6. public string name{ getset; }  
  7. private double Salary;  
  8. public double salary  
  9. {  
  10. get { return Salary; }  
  11. set  
  12. {  
  13. Salary= value;  
  14. if (Salary< 0) Salary= 0;  
  15. }  
  16. }  
  17. // constructor de clasa  
  18. public employee(string _name= "Neinitializat"double _salary= 0)  
  19. {  
  20. salary= _salary;  
  21. name = _name;  
  22. }  
  23. //constructor de copiere  
  24. public produs (salary s)  
  25. {  
  26. salary= s.salary;  
  27. nsme = s.name;  
  28. }  
  29. public void citire()  
  30. {  
  31. Console.WriteLine("NAme:"); name = Console.ReadLine();  
  32. Console.WriteLine("Salary:");Salary=double.Parse(Console.ReadLine());  
  33. }  
  34. public void scriere()  
  35. {  
  36. Console.WriteLine(name + "," + Salary);  
  37. }  
  38. };  
  39. class Program  
  40. {  
  41. static void Main(string[] args)  
  42. {  
  43. }  
  44. }  
  45. }  

Answers (2)