hello, and happy new year!
i'd like you guys and girls to show me another or similar but a bit different way to write this code, which a simple employe class with 4 different sub-employers types. thanks. this code is not mine, and i need to write somethink like this but not exactly this way.
the code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
public static void Main(string[] args)
{
string name, lastName, bDate;
SellsMan s;
Console.WriteLine("Chois: mazkir(m)/sellsMan(s):");
char chois = char.Parse(Console.ReadLine());
if (chois == 'm')
set_employe(name,lastName,bDate);
Mazkir m = new Mazkir(name,lastName,bDate);
}
public static string set_employe(string name, string lastName, string bDate)
{
Console.Clear();
Console.WriteLine("------------- Set Mazkir ----------\n\n");
Console.WriteLine("Enter the name:");
name = Console.ReadLine();
Console.WriteLine("\nEnter the last name: ");
lastName = Console.ReadLine();
Console.WriteLine("\nEnter the BirthDate: ");
bDate = Console.ReadLine();
return name;
return lastName;
return bDate;
}
}
class employe
{
private string name;
private string lastNmae;
private string bDate;
private float salPerHour;
private float hoursPerMonth;
private float baseSal;
private int sells;
private int bonusPerSell;
public employe(string name, string lastName, string bDate)
{
this.name = name;
this.lastNmae = lastName;
this.bDate = bDate;
}
public void setMazkir(float salPerHour, float hoursPerMonth)
{
this.salPerHour = salPerHour;
this.hoursPerMonth = hoursPerMonth;
}
public void base_Sal(int baseSal)
{
this.baseSal = baseSal;
}
public void bonus_PerSell(int bonusPerSale)
{
this.bonusPerSell = bonusPerSale;
}
public void kamut_mechirot(int sells)
{
this.sells = sells;
}
public void Print()
{
Console.WriteLine("\n\nthe name is: {0}, last is: {1} and age is: {2}", name, lastNmae, bDate);
Console.WriteLine("\nsal per hour is: {0}", salPerHour);
}
}
class Mazkir : employe
{
public Mazkir(string name, string lastName, string bDate): base(name, lastName, bDate)
{
}
public void salPerHour(float salPerHour, float hoursPerMonth)
{
base.setMazkir(salPerHour, hoursPerMonth);
}
}
class SellsMan : employe
{
public SellsMan(string name, string lastName, string bDate)
: base(name, lastName, bDate)
{
}
public void setSellsMan(int baseSale, int Bonus, int sells)
{
base.base_Sal(baseSale);
base.bonus_PerSell(Bonus);
base.kamut_mechirot(sells);
}
}
}