I'm learning class amd interface and I have a problem.
This is just an example where I try to learn.
I have this interface and classes.
class Candidate
{
string Name { get; set; }
List
}
public class Skill
{
public string Name { get;set; }
public int Level { get;set; }
public Skill(string name, int level)
{
this.Name = name;
this.Level = level;
}
interface ICandidateSearch //interface for search
{
List
List
}
I would create a CandidateSearch class, which impliments
the interface and holds the list of candidates to be searched.
Each candidate has one name and more Skills and SkillLevels.
Example:
Name="Bob B.", Skill="SQL","MVC","C#", SkillLevels= 5,3,4
It is not possible to be
Bob B. C# 4
Bob B. SQL 5
because it can be done about the two men with the same name
and should be a man with more skill and skillLevel.
The point is that one kanditat has more skill and skillLevel.
I would anyone want to help me to write and publish ConsoleApplication cod.
I said that I teach class and interface.
Much easier for me to understand the whole cod than just individual parts.
An example of how an application should be:
Suppose we have a list of three candidates!
Name="Bob B.", Skill="SQL","MVC","C#", SkillLevels= 4,3,5
Name="John K.", Skill="SharePoint","SQL","C#", SkillLevels= 3,5,5
Name="Peter B.", Skill="SQL","ASP.NET","XML", SkillLevels= 5,4,4
First Search:
Our input:
Skill: C#
SkillLevels: 5
output:
Bob B.,John K.
Two Search:
Our input:
Skill: SQL
SkillLevels: 5
output:
John K.,Peter B.
VulpesPosted Jul 17, 2011, 6:37 PM
VulpesPosted Jul 22, 2011, 5:46 AM
http://www.c-sharpcorner.com/UploadFile/5ce05b/5821/
secerka secerovicPosted Jul 21, 2011, 4:18 PM
I used the first code that you sent to me, I just made a change here
foreach (Skill cs in c.Skills)
{
if (s.Name == cs.Name && s.Level <= cs.Level) //change
{
Because I'm begginer I realized along with writing code I need to write tests.
So I started to learn Nunit tests.I use wrox literature and www.nunit.org.
Now I'm trayng to write test for this specific cod.
Unfortunately I couldn't do it. :(
I would ask you if you can help me with writing tests for this kod.
I need fo find Bob B with assert in frst test with this certain parameters(skill and skillLevel)
and in another test I need to find more people, maybe two or three people with this parameters.
How to check whether these are people who I'm searching for?
VulpesPosted Jul 18, 2011, 5:57 AM
For example, if you insert this code after the stuff for list5:
then you should get the line:
Bob B.
as he's the only candidate that has the C# and MVC skills.
If you wanted to return candidates who have the necessary skills but at a level which is within 1 of the input level, then you have two choices:
1. Create another override of the Find() method which takes a List
2. Alter the existing Find() method, so that it always returns candidates whose skill levels are within one of the input level.
secerka secerovicPosted Jul 18, 2011, 5:32 AM
I Understand that with this line of code I am looking for candidates who do not exist.
Could you write me code that would put in my list candidates with the first greater or the first lower skillLevel?
For example of this skill MVC and skiliLevel 2 that the list printed Bob B. who has skill MVC but skillLevel 2.
Thank you very much for helping me with this practical advice!
secerka secerovicPosted Jul 17, 2011, 5:51 PM
Essentially to be sought applications.
This application gives the result
Bob B., John K.
John K., Peter B.
That's fine!
But I'm in
CandidateSearch candSearch = new CandidateSearch(candidates);
added another list4.Add(new Skill("MVC", 2));
wanting to change my code and try to understand what you have done.
After this result is John K., Peter B.
Can you explain to me what did I do?
Can you write the code as I would with this addition as a result he and Bob B. ?
I said that I teach classes and interfaces.
I am grateful to you for your help.
VulpesPosted Jul 17, 2011, 11:51 AM